Min version is now v0.124.0. Using site.Config.Services.GoogleAnalytics.ID, hugo.IsMultilingual and hugo.yaml etc.
This commit is contained in:
parent
ea9f10193a
commit
2ae8ee84ee
1 changed files with 9 additions and 10 deletions
|
|
@ -1,4 +1,3 @@
|
|||
{{ $gaid := (or site.Config.Services.GoogleAnalytics.ID site.GoogleAnalytics) -}}
|
||||
{{ $opts := dict
|
||||
"minify" true
|
||||
"params" (dict
|
||||
|
|
@ -6,7 +5,7 @@
|
|||
"piwikTrackerUrl" site.Params.piwikTrackerUrl
|
||||
"piwikSiteID" site.Params.piwikSiteID
|
||||
"plausibleSiteID" site.Params.plausibleSiteID
|
||||
"GoogleAnalytics" $gaid) -}}
|
||||
"GoogleAnalytics" site.Config.Services.GoogleAnalytics.ID) -}}
|
||||
{{ if eq hugo.Environment "development" -}}
|
||||
{{ $opts = merge $opts (dict "minify" false) -}}
|
||||
{{ end -}}
|
||||
|
|
@ -20,7 +19,7 @@
|
|||
<script async defer data-domain="{{ site.Params.plausibleSiteID }}" src="{{ site.Params.plausibleTrackerURL | default "https://plausible.io/js/plausible.js" }}"></script>
|
||||
{{ end -}}
|
||||
|
||||
{{ if $gaid -}}
|
||||
{{ if site.Config.Services.GoogleAnalytics.ID -}}
|
||||
{{ $script := resources.Get "js/tracking.js" | js.Build $opts | fingerprint -}}
|
||||
<script src="{{ $script.RelPermalink }}"></script>
|
||||
{{ template "_internal/google_analytics.html" . }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue