Skip to content
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 HTML snippet for Plausible metrics #1564

Merged
merged 5 commits into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions source/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# -- Project information ---------------------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import os

# Some options are only enabled for the main packaging.python.org deployment builds
RTD_BUILD = bool(os.getenv("READTHEDOCS"))
RTD_PR_BUILD = RTD_BUILD and os.getenv("READTHEDOCS_VERSION_TYPE") == "external"
RTD_URL = os.getenv("READTHEDOCS_CANONICAL_URL")
RTD_CANONICAL_BUILD = (
RTD_BUILD and not RTD_PR_BUILD and "packaging.python.org" in RTD_URL
)

project = "Python Packaging User Guide"

copyright = "2013–2020, PyPA"
Expand Down Expand Up @@ -55,6 +65,18 @@
html_favicon = "assets/py.png"
html_last_updated_fmt = ""

_metrics_js_files = [
(
"https://plausible.io/js/script.js",
{"data-domain": "packaging.python.org", "defer": "defer"},
)
]
html_js_files = []
if RTD_CANONICAL_BUILD:
# Enable collection of the visitor metrics reported at
# https://plausible.io/packaging.python.org
html_js_files.extend(_metrics_js_files)
ncoghlan marked this conversation as resolved.
Show resolved Hide resolved

# -- Options for HTML help output ------------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-help-output

Expand Down
Loading