mirror of
https://github.com/theNewDynamic/gohugo-theme-ananke.git
synced 2025-06-08 09:12:47 +00:00
try and fix g-analytics
make use of gtag code provided by g-analytics console as a partial here
This commit is contained in:
parent
a711406964
commit
698c637299
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
{{ partial "site-style.html" . }}
|
{{ partial "site-style.html" . }}
|
||||||
{{ partial "site-scripts.html" . }}
|
{{ partial "site-scripts.html" . }}
|
||||||
|
|
||||||
{{ block "favicon" . }}
|
{{ block "favicon" . }}
|
||||||
{{ partialCached "site-favicon.html" . }}
|
{{ partialCached "site-favicon.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@ -30,14 +30,14 @@
|
|||||||
<link href="{{ .RelPermalink }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}" />
|
<link href="{{ .RelPermalink }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}}
|
{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}}
|
||||||
{{- template "_internal/opengraph.html" . -}}
|
{{- template "_internal/opengraph.html" . -}}
|
||||||
{{- template "_internal/schema.html" . -}}
|
{{- template "_internal/schema.html" . -}}
|
||||||
{{- template "_internal/twitter_cards.html" . -}}
|
{{- template "_internal/twitter_cards.html" . -}}
|
||||||
|
|
||||||
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
|
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
|
||||||
{{ template "_internal/google_analytics_async.html" . }}
|
{{ partial "analytics-gtag.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ block "head" . }}{{ partial "head-additions.html" . }}{{ end }}
|
{{ block "head" . }}{{ partial "head-additions.html" . }}{{ end }}
|
||||||
</head>
|
</head>
|
||||||
|
9
layouts/partials/analytics-gtag.html
Normal file
9
layouts/partials/analytics-gtag.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<!-- 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>
|
Loading…
x
Reference in New Issue
Block a user