From 638903353764fbcfc44b19f1d444d3b8060bcaa2 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 6 Jul 2022 00:17:05 +0200 Subject: Load ga.js only on production mode --- layouts/partials/scripts.html | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'layouts') diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index d01bd8b..ace6e45 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -35,12 +35,14 @@ {{- end -}} -{{- with site.GoogleAnalytics -}} - {{- $ga := resources.Get "js/ga.js" | minify -}} - {{- if not site.Params.assets.disable_fingerprinting -}} - {{- $ga = $ga | fingerprint -}} - - {{- else -}} - +{{- if or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production") }} + {{- with site.GoogleAnalytics -}} + {{- $ga := resources.Get "js/ga.js" | minify -}} + {{- if not site.Params.assets.disable_fingerprinting -}} + {{- $ga = $ga | fingerprint -}} + + {{- else -}} + + {{- end -}} {{- end -}} {{- end -}} -- cgit v1.2.3