Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e6605f

Browse files
miss-islingtonhugovkJulienPalard
authored
[3.13] Add Plausible for docs metrics (GH-119977) (#120193)
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Julien Palard <[email protected]>
1 parent 56a7e04 commit 0e6605f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Doc/conf.py

Lines changed: 2 additions & 1 deletion
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

Lines changed: 3 additions & 0 deletions
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)