Skip to content

Commit

Permalink
Add Plausible for docs metrics (#119977)
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Palard <[email protected]>
  • Loading branch information
hugovk and JulienPalard authored Jun 7, 2024
1 parent 6b60652 commit 5c11556
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions Doc/tools/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down

0 comments on commit 5c11556

Please sign in to comment.