diff --git a/docs/conf.py b/docs/conf.py index ff49d1ff..d4de6470 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -131,6 +131,10 @@ def setup(app): "nbsphinx", # Execute .ipynb files to generate html ] +# Some extensions should only be run if we are on Read the Docs +if os.environ.get("READTHEDOCS") == "True": + extensions.append("sphinxcontrib.googleanalytics") + # Napoleon settings napoleon_google_docstring = True napoleon_numpy_docstring = True @@ -324,3 +328,7 @@ def setup(app): # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True + +# -- Options for Google Analytics extension ---------------------------------- + +googleanalytics_id = "G-PXNCNN1G5C" diff --git a/requirements-docs.txt b/requirements-docs.txt index 07ffb6e1..e4ec8ee9 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -9,3 +9,4 @@ sphinx; python_version<'3.6' sphinx>=6.0.0; python_version>='3.6' sphinx-autobuild sphinx_rtd_theme; python_version<'3.6' +sphinxcontrib-googleanalytics>=0.4