{{ $gaid := (or site.Config.Services.GoogleAnalytics.ID site.GoogleAnalytics) -}}
{{ $opts := dict
"minify" true
"params" (dict
"cookieConsent" site.Params.cookieConsent
"piwikTrackerUrl" site.Params.piwikTrackerUrl
"piwikSiteID" site.Params.piwikSiteID
"plausibleSiteID" site.Params.plausibleSiteID
"GoogleAnalytics" $gaid) -}}
{{ if eq hugo.Environment "development" -}}
{{ $opts = merge $opts (dict "minify" false) -}}
{{ end -}}
{{ if and site.Params.piwikTrackerUrl site.Params.piwikSiteID -}}
{{ $script := resources.Get "js/tracking.js" | js.Build $opts | fingerprint -}}
{{ end -}}
{{ if site.Params.plausibleSiteID -}}
{{ end -}}
{{ if $gaid -}}
{{ $script := resources.Get "js/tracking.js" | js.Build $opts | fingerprint -}}
{{ template "_internal/google_analytics.html" . }}
{{ end -}}