From 8b78d5fa3dda6ed2990fef6c011afa11432b4918 Mon Sep 17 00:00:00 2001 From: Olivier Date: Sun, 7 Aug 2022 18:36:45 -0400 Subject: [PATCH] Updated tag content to match new GA instructions --- sphinxcontrib/googleanalytics.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sphinxcontrib/googleanalytics.py b/sphinxcontrib/googleanalytics.py index a223c66..1863e9e 100644 --- a/sphinxcontrib/googleanalytics.py +++ b/sphinxcontrib/googleanalytics.py @@ -3,29 +3,31 @@ from sphinx.errors import ExtensionError + def add_ga_javascript(app, pagename, templatename, context, doctree): if not app.config.googleanalytics_enabled: return metatags = context.get('metatags', '') - metatags += """""" % app.config.googleanalytics_id + metatags += """ + + """ % app.config.googleanalytics_id + metatags += """ + + """ % app.config.googleanalytics_id context['metatags'] = metatags + def check_config(app): if not app.config.googleanalytics_id: raise ExtensionError("'googleanalytics_id' config value must be set for ga statistics to function properly.") + def setup(app): app.add_config_value('googleanalytics_id', '', 'html') app.add_config_value('googleanalytics_enabled', True, 'html')