Skip to content

Commit 92a38e9

Browse files
miss-islingtonhugovkJulienPalard
authored
[3.12] Add Plausible for docs metrics (GH-119977) (#120194)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Julien Palard <julien@palard.fr>
1 parent 59224b8 commit 92a38e9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: Doc/conf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@
323323
html_context = {
324324
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
325325
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
326-
"pr_id": os.getenv("READTHEDOCS_VERSION")
326+
"pr_id": os.getenv("READTHEDOCS_VERSION"),
327+
"enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"),
327328
}
328329

329330
# This 'Last updated on:' timestamp is inserted at the bottom of every page.

Diff for: Doc/tools/templates/layout.html

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
{% endblock %}
2727

2828
{% block extrahead %}
29+
{% if builder == "html" and enable_analytics %}
30+
<script defer data-domain="docs.python.org" src="https://plausible.io/js/script.js"></script>
31+
{% endif %}
2932
<link rel="canonical" href="https://docs.python.org/3/{{pagename}}.html" />
3033
{% if builder != "htmlhelp" %}
3134
{% if pagename == 'whatsnew/changelog' and not embedded %}

0 commit comments

Comments
 (0)