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

github.com/bul-ikana/hugo-cards.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Aguirre <bul-ikana@users.noreply.github.com>2021-11-01 02:27:46 +0300
committerGitHub <noreply@github.com>2021-11-01 02:27:46 +0300
commit55e3034953476d425221a66b5cdd31478b245e88 (patch)
treec9a7cccf55d838c067feb187af1988fd2ff94ffb
parente953bf3bbd01dabece14e86fd76d275325674e61 (diff)
parent0e14929f4d2a7e0489d83b41a633d1a82ee9b7b2 (diff)
Merge pull request #25 from bul-ikana/update-ga-docsHEADmaster
Update ga docs
-rw-r--r--README.md2
-rw-r--r--exampleSite/config.toml5
-rw-r--r--layouts/partials/analytics.html22
3 files changed, 14 insertions, 15 deletions
diff --git a/README.md b/README.md
index 328f188..10fe3d5 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,7 @@ The title of the like box. This text will be shown while the box is loading.
### Tracking and comments
#### analytics
-The Google Analytics tracking ID supporting both Universal Analytics and GA4
+The Google Analytics tracking ID supporting both Universal Analytics and GA4. Universal Anylitics will be used by default, unless`params.analytics.type` is set as `GA4`.
#### disqus
The disqus_thread ID
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index b134895..b649bc3 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -20,13 +20,12 @@ paginate = 6
fbPageUrl = ""
fbPageTitle = ""
- analytics = ""
disqus = ""
-
+
custom_css = ["css/custom.css"]
[params.analytics]
- type=""
+ type="UA"
trackingID = ""
[params.copyright]
diff --git a/layouts/partials/analytics.html b/layouts/partials/analytics.html
index ddeeb3e..aef6667 100644
--- a/layouts/partials/analytics.html
+++ b/layouts/partials/analytics.html
@@ -1,4 +1,14 @@
-{{ if eq .type "UA" }}
+{{ if eq .type "GA4" }}
+<!-- GA4 type - Global site tag (gtag.js) - Google Analytics -->
+<script async src="https://www.googletagmanager.com/gtag/js?id={{ .trackingID }}"></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', '{{ .trackingID }}');
+</script>
+{{ else }}
<!-- UA Tracking type Google Analytics Tracking code -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -9,14 +19,4 @@
ga('create', '{{ .trackingID }}', 'auto');
ga('send', 'pageview');
</script>
-{{ else }}
-<!-- GA4 type - Global site tag (gtag.js) - Google Analytics -->
-<script async src="https://www.googletagmanager.com/gtag/js?id={{ .trackingID }}"></script>
-<script>
- window.dataLayer = window.dataLayer || [];
- function gtag(){dataLayer.push(arguments);}
- gtag('js', new Date());
-
- gtag('config', '{{ .trackingID }}');
-</script>
{{ end }} \ No newline at end of file