try and fix g-analytics

make use of gtag code provided by g-analytics console as a partial here
This commit is contained in:
kirk 2022-04-05 00:00:50 -05:00
parent a711406964
commit 698c637299
2 changed files with 12 additions and 3 deletions

View File

@ -37,7 +37,7 @@
{{- template "_internal/twitter_cards.html" . -}}
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{ template "_internal/google_analytics_async.html" . }}
{{ partial "analytics-gtag.html" . }}
{{ end }}
{{ block "head" . }}{{ partial "head-additions.html" . }}{{ end }}
</head>

View File

@ -0,0 +1,9 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.GoogleAnalytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ .Site.GoogleAnalytics }}');
</script>