diff options
author | KaitaKoinuma <inuinunekonekoinu@gmail.com> | 2021-12-09 21:15:14 +0300 |
---|---|---|
committer | coderzh <coderzh@gmail.com> | 2021-12-18 16:09:34 +0300 |
commit | 4704d1c6c736ee81d5acf1654e24adc8ee9c66bd (patch) | |
tree | bf2c3dd282062d6dc3b0bd585c19246c7bfa3e75 | |
parent | 15b6596077df4c018f207715764f0f8910cb2430 (diff) |
create new version google analytics tag file and add gtag_ID to config.toml for loading in that file
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/partials/gtag_google_analytics.html | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index d63208a..3d50cea 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -38,6 +38,7 @@ pygmentsUseClasses = true [Params.GoogleAnalytics] ID = "" + gtag_ID = "" [Params.Disqus] ShortName = "" diff --git a/layouts/partials/gtag_google_analytics.html b/layouts/partials/gtag_google_analytics.html new file mode 100644 index 0000000..9964d38 --- /dev/null +++ b/layouts/partials/gtag_google_analytics.html @@ -0,0 +1,11 @@ +{{ if .Site.Params.GoogleAnalytics.gtag_ID }} +<!-- Global site tag (gtag.js) - Google Analytics --> +<script async src="https://www.googletagmanager.com/gtag/js?id=G-V3LR3XT2Y5"></script> +<script> + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + + gtag('config', '{{ .Site.Params.GoogleAnalytics.gtag_ID }}'); +</script> +{{ end }} |