-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Plausible for docs metrics #119977
Add Plausible for docs metrics #119977
Conversation
This reverts commit e76d290.
Something like this could prevent plausible to land on HTML builds distributed out of docs.python.org (like linux distribs): --- 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. --- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -26,7 +26,7 @@
{% endblock %}
{% block extrahead %}
- {% if builder == "html" %}
+ {% 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" /> |
Co-authored-by: Julien Palard <[email protected]>
Thanks for the diff! I've added that to the PR, and verified locally the snippet only shows in the HTML when building with the env var set. |
Merging to give a chance to be deployed. It won't be active until the env var is set by python/psf-salt#357. |
Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
(cherry picked from commit 5c11556) Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Julien Palard <[email protected]>
GH-120193 is a backport of this pull request to the 3.13 branch. |
(cherry picked from commit 5c11556) Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Julien Palard <[email protected]>
GH-120194 is a backport of this pull request to the 3.12 branch. |
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Julien Palard <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Julien Palard <[email protected]>
Co-authored-by: Julien Palard <[email protected]>
Co-authored-by: Julien Palard <[email protected]>
We're going to continue using Plausible for stats. The account is ready, let's merge this so we can begin collecting stats, and then look into one of the options suggested at #107136.
📚 Documentation preview 📚: https://cpython-previews--119977.org.readthedocs.build/