Add Plausible for docs metrics#119977
Merged
Merged
Conversation
This reverts commit e76d290.
Member
|
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 <julien@palard.fr>
Member
Author
|
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. |
Member
Author
|
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. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jun 7, 2024
(cherry picked from commit 5c11556) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Julien Palard <julien@palard.fr>
|
GH-120193 is a backport of this pull request to the 3.13 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jun 7, 2024
(cherry picked from commit 5c11556) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Julien Palard <julien@palard.fr>
|
GH-120194 is a backport of this pull request to the 3.12 branch. |
hugovk
added a commit
that referenced
this pull request
Jun 7, 2024
hugovk
added a commit
that referenced
this pull request
Jun 7, 2024
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this pull request
Jul 11, 2024
Co-authored-by: Julien Palard <julien@palard.fr>
estyxx
pushed a commit
to estyxx/cpython
that referenced
this pull request
Jul 17, 2024
Co-authored-by: Julien Palard <julien@palard.fr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/