From cf45bc041258cd2696bb1b9a48f0631f9cf20420 Mon Sep 17 00:00:00 2001 From: Christian Cardone <51024388+Christian-Cardone@users.noreply.github.com> Date: Tue, 15 Dec 2020 10:09:05 +0000 Subject: [PATCH] Add Google Global Site Tags configuration for new Google Analytics 4 This addition enables users to set their Google Measurement ID into the variable GOOGLE_GLOBAL_SITE_TAG in pelicanconf so that they can track analytics using GA 4 Closes #256 (#257) --- docs/pelicanconf.py | 4 ++++ templates/base.html | 4 ++++ templates/partial/ggst.html | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 templates/partial/ggst.html diff --git a/docs/pelicanconf.py b/docs/pelicanconf.py index e6055b4..30c9624 100644 --- a/docs/pelicanconf.py +++ b/docs/pelicanconf.py @@ -77,3 +77,7 @@ THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE = True THEME_COLOR_ENABLE_USER_OVERRIDE = True USE_LESS = True + +# GOOGLE ANALYTICS +# For Google Analytics 4 use. Note that for old Google Analytics ('UA-XXXXX') the GOOGLE_ANALYTICS variable is included in publishconfig.py +# GOOGLE_GLOBAL_SITE_TAG = 'G-XXXXX' diff --git a/templates/base.html b/templates/base.html index 9c1f3a2..3067590 100644 --- a/templates/base.html +++ b/templates/base.html @@ -102,6 +102,10 @@ {% if GOOGLE_ANALYTICS %} {% include "partial/ga.html" %} {% endif %} + + {% if GOOGLE_GLOBAL_SITE_TAG %} + {% include "partial/ggst.html" %} + {% endif %} {% if BROWSER_COLOR %} diff --git a/templates/partial/ggst.html b/templates/partial/ggst.html new file mode 100644 index 0000000..bac7d3a --- /dev/null +++ b/templates/partial/ggst.html @@ -0,0 +1,10 @@ + + + + \ No newline at end of file