GA4 support was added to the non-async version of the built-in Google Analytics (see: hugo/tpl/tplimpl/embedded/templates at master · gohugoio/hugo · GitHub )
You may want to check, and then update, the theme’s call for GA from google_analytics_async.html
to google_analytics.html
.
From:
{{- if .Site.GoogleAnalytics }}
{{ template "_internal/google_analytics_async.html" . }}
{{- end}}
To:
{{- if .Site.GoogleAnalytics }}
{{ template "_internal/google_analytics.html" . }}
{{- end}}
Since you said you have a google_analytics
param, then the theme is using its own GA code and param.
To use the built-in GA feature, add the above code shown (non-async version) somewhere in your theme’s baseof.html
or head.html
file. Then use the built-in param googleAnalytics ="G-"
in your config.toml (top-level; before any []
sections).
Edit: You can delete the custom param google_analytics
in your params.toml
file so the theme will not add its own GA embed–assuming it’s conditional, if not, there probably is a separate disable setting from the theme.
It should work then.
Shalom!