diff options
author | Vladimir Doroch <vladimir@doroch.de> | 2022-03-31 10:38:42 +0300 |
---|---|---|
committer | Vladimir Doroch <vladimir@doroch.de> | 2022-03-31 10:45:59 +0300 |
commit | ec0175a4ed4131f4cf26d723c243d388b421d7eb (patch) | |
tree | 44081a16f236de1e3e5e382d4dd96b2d2731652c | |
parent | d3057a5a8e49e1dcddd71914fffd6e6685ba6aac (diff) |
fix: loading the correct internal Google Analytics template for v4 token
Added if-clause to check prefix of googleAnalytics variable for v4 format ("G-"). Loading according internal template as specified in hugo docs.
Reviewed-by: Vladimir Doroch
Refs: #339
-rw-r--r-- | layouts/partials/footer.html | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index c7f4202..b231dc1 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -32,7 +32,11 @@ </footer> {{- partial "medium-zoom.html" .context -}} {{- partial "math.html" .context -}} -{{- template "_internal/google_analytics_async.html" .context -}} +{{- if (hasPrefix .context.Site.GoogleAnalytics "G-") -}} + {{- template "_internal/google_analytics.html" .context -}} +{{- else -}} + {{- template "_internal/google_analytics_async.html" .context -}} +{{- end -}} {{- if and (hugo.IsProduction) (.context.Site.Params.gtagId) -}} {{ partial "google-analytics-gtag-async.html" .context }} |