mirror of
https://github.com/maikka39/Personal-Website.git
synced 2026-10-24 06:56:59 +00:00
Move Google Analytics to gtag.js
This commit is contained in:
@@ -66,4 +66,17 @@
|
|||||||
type="application/json" title="{{ .Site.Title }}" />
|
type="application/json" title="{{ .Site.Title }}" />
|
||||||
{{ end }}
|
{{ 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 }}
|
||||||
Reference in New Issue
Block a user