diff options
author | Curtis Timson <curt@live.co.uk> | 2018-02-11 16:19:54 +0300 |
---|---|---|
committer | Curtis Timson <curt@live.co.uk> | 2018-02-11 16:19:54 +0300 |
commit | 015be9c366db320e7bd7a3dc85425f03c841fc01 (patch) | |
tree | d19d73f2145c7e7ac7297a07305c10c78100155e | |
parent | bdc694cf69ba437c3958326472fcfae4ef644e89 (diff) |
:sparkles: Add Google Analytics support #12
-rw-r--r-- | exampleSite/config-prod.toml | 4 | ||||
-rw-r--r-- | exampleSite/config.toml | 4 | ||||
-rw-r--r-- | layouts/partials/scripts.html | 14 | ||||
-rw-r--r-- | package.json | 2 |
4 files changed, 21 insertions, 3 deletions
diff --git a/exampleSite/config-prod.toml b/exampleSite/config-prod.toml index 939b230..8345c70 100644 --- a/exampleSite/config-prod.toml +++ b/exampleSite/config-prod.toml @@ -55,4 +55,6 @@ theme = "../.." [params.contact] email = "someone@untitled.tld" phone = "(800) 000-0000" -
\ No newline at end of file + +[params.settings] + googleanalytics = "UA-113904582-2"
\ No newline at end of file diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a00cdc2..6b2852d 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -55,4 +55,6 @@ theme = "../.." [params.contact] email = "someone@untitled.tld" phone = "(800) 000-0000" -
\ No newline at end of file + +[params.settings] + googleanalytics = "UA-113904582-1"
\ No newline at end of file diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 8cbe31f..8eb56ab 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -6,4 +6,18 @@ <script src="{{ .Site.BaseURL }}assets/js/util.js"></script> <!--[if lte IE 8]><script src="{{ .Site.BaseURL }}assets/js/ie/respond.min.js"></script><![endif]--> <script src="{{ .Site.BaseURL }}assets/js/main.js"></script> + +{{ if .Site.Params.Settings.googleanalytics }} +<!-- Global site tag (gtag.js) - Google Analytics --> +<script async src="https://www.googletagmanager.com/gtag/js?id=UA-113904582-1"></script> +<script> + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + + gtag('config', {{ .Site.Params.Settings.googleanalytics }}); +</script> + +{{ end }} + {{ partial "scriptscustom.html" . }}
\ No newline at end of file diff --git a/package.json b/package.json index fa7d83f..8dde085 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hugo-theme-dopetrope", - "version": "1.0.0", + "version": "1.1.0", "description": "Hugo Theme Dopetrope", "main": "index.js", "scripts": { |