Skip to content

Commit

Permalink
fix: loading the correct internal Google Analytics template for v4 token
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vladimirdoroch committed Mar 31, 2022
1 parent d3057a5 commit ec0175a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down

0 comments on commit ec0175a

Please sign in to comment.