Skip to content

Commit ba00747

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

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
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': True,
191+
}
187192

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

0 commit comments

Comments
 (0)