diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 5a705da..898bbc4 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -93,7 +93,7 @@
{{- end }}
-{{- if and (not .Site.IsServer) .Site.GoogleAnalytics -}}
+{{- if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and .Site.GoogleAnalytics -}}
{{ template "_internal/google_analytics_async.html" . }}
{{- end -}}