Skip to content

Commit 1370be8

Browse files
committed
DOC: Add an option to disable Google Analytics.
Fixes #5823.
1 parent 34f99a9 commit 1370be8

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

doc/_templates/layout.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
{%- endif %}
9797
</div>
9898
</footer>
99+
{%- if include_analytics %}
99100
<script>
100101
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
101102
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -106,4 +107,5 @@
106107
ga('send', 'pageview');
107108

108109
</script>
110+
{%- endif %}
109111
{%- endblock %}

doc/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,12 @@ def _check_dependencies():
183183
except (subprocess.CalledProcessError, FileNotFoundError):
184184
SHA = matplotlib.__version__
185185

186-
html_context = {'sha': SHA}
186+
html_context = {
187+
'sha': SHA,
188+
# This will disable any analytics in the HTML templates (currently Google
189+
# Analytics.)
190+
'include_analytics': False,
191+
}
187192

188193
project = 'Matplotlib'
189194
copyright = ('2002 - 2012 John Hunter, Darren Dale, Eric Firing, '

doc/devel/release_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ build the docs from the ``ver-doc`` branch. An easy way to arrange this is::
313313
pip install -r requirements/doc/doc-requirements.txt
314314
git checkout v2.0.0-doc
315315
git clean -xfd
316-
make -Cdoc O=-j$(nproc) html latexpdf LATEXMKOPTS="-silent -f"
316+
make -Cdoc O="-Ainclude_analytics=True -j$(nproc)" html latexpdf LATEXMKOPTS="-silent -f"
317317

318318
which will build both the html and pdf version of the documentation.
319319

0 commit comments

Comments
 (0)