diff options
Diffstat (limited to 'layouts/partials/google_analytics.html')
-rw-r--r-- | layouts/partials/google_analytics.html | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/layouts/partials/google_analytics.html b/layouts/partials/google_analytics.html index 3194883..05c2e8d 100644 --- a/layouts/partials/google_analytics.html +++ b/layouts/partials/google_analytics.html @@ -1,12 +1,11 @@ {{ if isset .Site.Params "google_analytics_id" }} +<!-- Global site tag (gtag.js) - Google Analytics --> +<script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.Params.google_analytics_id }}"></script> <script> - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - - ga('create', '{{ .Site.Params.google_analytics_id }}', 'auto'); - ga('send', 'pageview'); + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); +gtag('config', '{{ .Site.Params.google_analytics_id }}'); </script> {{ end }} |