diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a4ec55c..d45f11b 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -39,8 +39,12 @@ --> -{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} - {{ template "_internal/google_analytics_async.html" . }} +{{ if and (.Site.GoogleAnalytics) (or (eq (getenv "HUGO_ENV") "production") (eq .Site.Params.env "production")) }} + {{ if hasPrefix .Site.GoogleAnalytics "UA-" }} + {{ template "_internal/google_analytics_async.html" . }} + {{ else }} + {{ template "_internal/google_analytics.html" . }} + {{ end }} {{ end }} {{ partial "head-extra.html" . }}