diff --git a/layouts/partials/analytics.html b/layouts/partials/analytics.html index fc5abb524..58e83f5df 100644 --- a/layouts/partials/analytics.html +++ b/layouts/partials/analytics.html @@ -4,9 +4,7 @@ {{ with .services }} {{ with .google }} - {{ $privacyConfig:= dict (slice "Site" "Config" "Privacy" "GoogleAnalytics") $.Site.Config.Privacy.GoogleAnalytics }} - {{ $analyticsConfig := dict (slice "Site" "Config" "Services" "GoogleAnalytics" "ID") .id }} - {{ template "_internal/google_analytics.html" (merge $privacyConfig $analyticsConfig) }} + {{ partial "google_analytics.html" . }} {{ end }} diff --git a/layouts/partials/google_analytics.html b/layouts/partials/google_analytics.html new file mode 100644 index 000000000..4d451c1a6 --- /dev/null +++ b/layouts/partials/google_analytics.html @@ -0,0 +1,22 @@ +{{ if site.Params.features.analytics.enabled }} + {{- with site.Params.features.analytics.services.google.id }} + {{- if strings.HasPrefix (lower .) "ua-" }} + {{- warnf "Google Analytics 4 (GA4) replaced Google Universal Analytics (UA) effective 1 July 2023. See https://support.google.com/analytics/answer/11583528. Create a GA4 property and data stream, then replace the Google Analytics ID in your site configuration with the new value." }} + {{- else }} + + + {{- end }} + {{- end }} +{{- end -}} \ No newline at end of file