https://github.com/python/cpython/commit/0e6605f633f3eee6a4e4b09bbd3cfceb2d80ef48
commit: 0e6605f633f3eee6a4e4b09bbd3cfceb2d80ef48
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2024-06-07T10:42:19+03:00
summary:

[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]>

files:
M Doc/conf.py
M Doc/tools/templates/layout.html

diff --git a/Doc/conf.py b/Doc/conf.py
index 47fb96fe1de482..8a14646801ebac 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -339,7 +339,8 @@
 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 3f88fc8e91faad..b09fd21a8ddcc9 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 %}

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to