diff --git a/layouts/partials/marketing/google_analytics.html b/layouts/partials/marketing/google_analytics.html
index e504b603..d870fd5f 100644
--- a/layouts/partials/marketing/google_analytics.html
+++ b/layouts/partials/marketing/google_analytics.html
@@ -1,7 +1,7 @@
{{ $ga := site.Params.marketing.google_analytics | default site.GoogleAnalytics | default "" }}
{{ $gtm := site.Params.marketing.google_tag_manager | default "" }}
-{{ if eq (getenv "HUGO_ENV") "production" | and $ga | and (not $gtm) }}
+{{ if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and $ga | and (not $gtm) }}
{{ $gtag_config := cond site.Params.privacy_pack "{ 'anonymize_ip': true }" "{}" }}
diff --git a/layouts/partials/marketing/google_tag_manager.html b/layouts/partials/marketing/google_tag_manager.html
index 1da839ab..6ae3abc6 100644
--- a/layouts/partials/marketing/google_tag_manager.html
+++ b/layouts/partials/marketing/google_tag_manager.html
@@ -1,4 +1,4 @@
-{{ if eq (getenv "HUGO_ENV") "production" | and site.Params.marketing.google_tag_manager }}
+{{ if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and site.Params.marketing.google_tag_manager }}