mirror of
https://github.com/python/cpython
synced 2024-09-05 00:05:39 +00:00
Add Plausible for docs metrics (#119977)
Co-authored-by: Julien Palard <julien@palard.fr>
This commit is contained in:
parent
6b606522ca
commit
5c115567b1
|
@ -339,7 +339,8 @@
|
||||||
html_context = {
|
html_context = {
|
||||||
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
|
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
|
||||||
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
|
"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.
|
# This 'Last updated on:' timestamp is inserted at the bottom of every page.
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extrahead %}
|
{% 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" />
|
<link rel="canonical" href="https://docs.python.org/3/{{pagename}}.html" />
|
||||||
{% if builder != "htmlhelp" %}
|
{% if builder != "htmlhelp" %}
|
||||||
{% if pagename == 'whatsnew/changelog' and not embedded %}
|
{% if pagename == 'whatsnew/changelog' and not embedded %}
|
||||||
|
|
Loading…
Reference in a new issue