Move Google Analytics to gtag.js

pull/4/head
Maik de Kruif 3 years ago
parent 4c2b22a349
commit 9a946495a1
No known key found for this signature in database
GPG Key ID: 46C1200ACD3A432F
  1. 15
      themes/maik-blog/layouts/partials/head.html

@ -66,4 +66,17 @@
type="application/json" title="{{ .Site.Title }}" />
{{ end }}
{{ template "_internal/google_analytics_async.html" . }}
{{ if .Site.GoogleAnalytics }}
<!-- 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>
{{ end }}
Loading…
Cancel
Save