-
Notifications
You must be signed in to change notification settings - Fork 905
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup of Google analytics templates (#2006)
- Loading branch information
Showing
4 changed files
with
31 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{/* | ||
|
||
This is a copy of https://github.com/gohugoio/hugo/pull/12505, | ||
which changes all `{{- ... }}` to `{{- ... }}. Drop this file if | ||
and once it is merged. | ||
|
||
*/ -}} | ||
|
||
{{ if not site.Config.Privacy.GoogleAnalytics.Disable }} | ||
{{- with site.Config.Services.GoogleAnalytics.ID }} | ||
{{- if strings.HasPrefix (lower .) "ua-" }} | ||
{{- warnf "Google Analytics 4 (GA4) replaced Google Universal Analytics (UA) effective 1 July 2023. See https://support.google.com/analytics/answer/11583528. Create a GA4 property and data stream, then replace the Google Analytics ID in your site configuration with the new value." }} | ||
{{- else }} | ||
<script async src="https://www.googletagmanager.com/gtag/js?id={{- . }}"></script> | ||
<script> | ||
var doNotTrack = false; | ||
if ({{ site.Config.Privacy.GoogleAnalytics.RespectDoNotTrack }}) { | ||
var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack); | ||
var doNotTrack = (dnt == "1" || dnt == "yes"); | ||
} | ||
if (!doNotTrack) { | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
gtag('config', '{{ . }}'); | ||
} | ||
</script> | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters