Skip to content

Commit

Permalink
Merge pull request #1564 from ncoghlan/add-plausible-metrics
Browse files Browse the repository at this point in the history
Add HTML snippet for Plausible metrics
  • Loading branch information
ncoghlan authored Jun 19, 2024
2 parents 641fd24 + 303c248 commit 3163062
Showing 1 changed file with 22 additions and 0 deletions.
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)

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

Expand Down

0 comments on commit 3163062

Please sign in to comment.