Skip to content

Commit

Permalink
DOC: Add an option to disable Google Analytics.
Browse files Browse the repository at this point in the history
Fixes #5823.
  • Loading branch information
QuLogic committed Sep 24, 2020
1 parent 34f99a9 commit 1370be8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
{%- endif %}
</div>
</footer>
{%- if include_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
Expand All @@ -106,4 +107,5 @@
ga('send', 'pageview');

</script>
{%- endif %}
{%- endblock %}
7 changes: 6 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ def _check_dependencies():
except (subprocess.CalledProcessError, FileNotFoundError):
SHA = matplotlib.__version__

html_context = {'sha': SHA}
html_context = {
'sha': SHA,
# This will disable any analytics in the HTML templates (currently Google
# Analytics.)
'include_analytics': False,
}

project = 'Matplotlib'
copyright = ('2002 - 2012 John Hunter, Darren Dale, Eric Firing, '
Expand Down
2 changes: 1 addition & 1 deletion doc/devel/release_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ build the docs from the ``ver-doc`` branch. An easy way to arrange this is::
pip install -r requirements/doc/doc-requirements.txt
git checkout v2.0.0-doc
git clean -xfd
make -Cdoc O=-j$(nproc) html latexpdf LATEXMKOPTS="-silent -f"
make -Cdoc O="-Ainclude_analytics=True -j$(nproc)" html latexpdf LATEXMKOPTS="-silent -f"

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

Expand Down

0 comments on commit 1370be8

Please sign in to comment.