Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/coderzh/hugo-pacman-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaitaKoinuma <inuinunekonekoinu@gmail.com>2021-12-09 21:15:14 +0300
committercoderzh <coderzh@gmail.com>2021-12-18 16:09:34 +0300
commit4704d1c6c736ee81d5acf1654e24adc8ee9c66bd (patch)
treebf2c3dd282062d6dc3b0bd585c19246c7bfa3e75
parent15b6596077df4c018f207715764f0f8910cb2430 (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.toml1
-rw-r--r--layouts/partials/gtag_google_analytics.html11
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 }}