Skip to content

Commit

Permalink
Revert "Added support for Google gtag.js via html.gtag"
Browse files Browse the repository at this point in the history
This reverts commit 1c6628a.
  • Loading branch information
jbogdani committed Sep 29, 2021
1 parent 1c6628a commit 234aaff
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 43 deletions.
16 changes: 0 additions & 16 deletions docs/tmpl_html.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,22 +675,6 @@ E.g.: `{{ html.getVersion }}`
```
---

#### gtag()
Returns javascript code for Google Global Tag (gtag.js). Google Analytics id must be provided in the site configuration file. A domain is provided in the configuration file; the code will be shown only if current domain matches the provided domain. This is very useful in test installations.

E.g.: `{{ html.gtag }}`

```javascript
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA-ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA-ID');
</script>
```
---
#### GUA()
Returns javascript code for Google Universal Analytics Tracking. Google Analytics id must be provided in the site configuration file. A domain is provided in the configuration file; the code will be shown only if current domain matches the provided domain. This is very useful in test installations.

Expand Down
26 changes: 0 additions & 26 deletions lib/OutHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,32 +616,6 @@ public function GUA()
return $html;
}

/**
* Returns html containing Google Global Tag (gtag.js)
* @return string
*/
public function gtag()
{
$id = cfg::get('ga_id');

$restrict_domain = cfg::get('ga_domain');


if ($id && (!$restrict_domain || (preg_match('/' . $restrict_domain . '/', $_SERVER['HTTP_HOST']))) && !$this->cfg['isDraft']) {
$html = '<!-- Global site tag (gtag.js) - Google Analytics -->' .
'<script async src="https://www.googletagmanager.com/gtag/js?id=' . $id . '"></script>' .
'<script>' .
'window.dataLayer = window.dataLayer || [];' .
'function gtag(){dataLayer.push(arguments);}' .
"gtag('js', new Date());" .

"gtag('config', '" . $id . "');".
'</script>';
}

return $html;
}


/**
* Returns html with image gallery. Alias for customTags:gallery()
Expand Down
1 change: 0 additions & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
5.8.0[] = "Added support for Google gtag.js via html.gtag"
5.7.1[] = "Removed debugging error_log in template_ctrl"
5.7.0[] = "Changed format of logAttempts, and rised time buffer to 2 seconds"
5.6.2[] = "Optimized calculation of path of assets"
Expand Down

0 comments on commit 234aaff

Please sign in to comment.