Skip to content

Commit 5c11556

Browse files
hugovkJulienPalard
andauthored
Add Plausible for docs metrics (#119977)
Co-authored-by: Julien Palard <[email protected]>
1 parent 6b60652 commit 5c11556

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Doc/conf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@
339339
html_context = {
340340
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
341341
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
342-
"pr_id": os.getenv("READTHEDOCS_VERSION")
342+
"pr_id": os.getenv("READTHEDOCS_VERSION"),
343+
"enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"),
343344
}
344345

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

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)