This commit is contained in:
Naresh 2025-04-16 11:46:16 +02:00 committed by GitHub
commit 806b10f099
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 5 deletions

View File

@ -32,7 +32,7 @@ Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-manageme
## Twitter Simple Shortcode ## Twitter Simple Shortcode
{{< twitter_simple 1085870671291310081 >}} {{< x user="" id="1085870671291310081" >}}
<br> <br>

View File

@ -1,4 +1,22 @@
{{ if not .Site.IsServer }} {{ if not site.Config.Privacy.GoogleAnalytics.Disable }}
{{ template "_internal/google_analytics.html" . }} {{- with site.Config.Services.GoogleAnalytics.ID }}
{{ template "_internal/google_analytics_async.html" . }} {{- if strings.HasPrefix (lower .) "ua-" }}
{{ end }} {{- 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 -}}