From 1cc265d99fab08585a41093147c86bf3e87a82a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 20 Sep 2022 10:22:53 +0200 Subject: [PATCH] Update the GA template usage section Mostly to remove the async example (not relevant for GA4 which people should be using by now). See https://github.com/gohugoio/hugo/issues/9987 --- content/en/templates/internal.md | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/content/en/templates/internal.md b/content/en/templates/internal.md index ace21f548..15f90b102 100644 --- a/content/en/templates/internal.md +++ b/content/en/templates/internal.md @@ -45,20 +45,13 @@ googleAnalytics = "G-MEASUREMENT_ID" ### Use the Google Analytics Template -You can then include the Google Analytics internal template: +You can then include the Google Analytics internal template in the `` section of your template: -``` -{{ template "_internal/google_analytics.html" . }} -``` - - -``` -{{ template "_internal/google_analytics_async.html" . }} -``` - -When using Google Analytics v4 use `_internal/google_analytics.html`. - -A `.Site.GoogleAnalytics` variable is also exposed from the config. +```go-html-template +{{ if hugo.IsProduction }} + {{ template "_internal/google_analytics.html" . }} +{{ end }} + ``` ## Disqus