summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/conf.py3
-rw-r--r--Doc/tools/templates/layout.html3
2 files changed, 5 insertions, 1 deletions
diff --git a/Doc/conf.py b/Doc/conf.py
index 47fb96f..8a14646 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -339,7 +339,8 @@ repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL")
html_context = {
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
- "pr_id": os.getenv("READTHEDOCS_VERSION")
+ "pr_id": os.getenv("READTHEDOCS_VERSION"),
+ "enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"),
}
# This 'Last updated on:' timestamp is inserted at the bottom of every page.
diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
index 3f88fc8..b09fd21 100644
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -26,6 +26,9 @@
{% endblock %}
{% block extrahead %}
+ {% if builder == "html" and enable_analytics %}
+ <script defer data-domain="docs.python.org" src="https://plausible.io/js/script.js"></script>
+ {% endif %}
<link rel="canonical" href="https://docs.python.org/3/{{pagename}}.html" />
{% if builder != "htmlhelp" %}
{% if pagename == 'whatsnew/changelog' and not embedded %}