Skip to content

Commit d968a85

Browse files
Enable Google Analytics using an extension (#1860)
Signed-off-by: Jean-Christophe Morin <[email protected]>
1 parent effa516 commit d968a85

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
sphinx >=7.0.0,<9.0.0
22
furo
33
myst-parser
4+
sphinxcontrib-googleanalytics

docs/source/conf.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"sphinx.ext.napoleon",
3939
"sphinx.ext.todo",
4040
"myst_parser",
41+
"sphinxcontrib.googleanalytics",
4142
# Rez custom extension
4243
'rez_sphinxext'
4344
]
@@ -117,6 +118,19 @@
117118

118119
todo_emit_warnings = False
119120

121+
# -- Options for googleanalytics extension ----------------------------------
122+
# https://github.com/sphinx-contrib/googleanalytics
123+
124+
# ReadTheDocs used to support Google Analytics natively. But they no more do
125+
# since July 2024. See https://github.com/readthedocs/readthedocs.org/issues/9530#issuecomment-2233541583
126+
127+
if not os.environ.get("READTHEDOCS"):
128+
# Don't activate if run locally
129+
googleanalytics_enabled = False
130+
131+
# https://jira.linuxfoundation.org/plugins/servlet/desk/portal/2/IT-26436
132+
googleanalytics_id = "G-G11PX36QZS"
133+
120134

121135
# -- Custom -----------------------------------------------------------------
122136

0 commit comments

Comments
 (0)