Skip to content

Commit 1d33600

Browse files
authored
Migrate entirely to our self-hosted Plausible instance for analytics (#17981)
* move blog to plausible analytics * add plausible to user docs * remove google analytics support
1 parent 399a2d5 commit 1d33600

File tree

13 files changed

+80
-144
lines changed

13 files changed

+80
-144
lines changed

docs/mkdocs-blog.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ plugins:
5252
# If we ever want to change the format and thus break old URLs,
5353
# consider https://github.com/mkdocs/mkdocs-redirects
5454
post_url_format: "posts/{file}"
55+
- material-plausible
5556
- rss:
5657
abstract_chars_count: -1
5758
categories:
@@ -82,10 +83,11 @@ extra:
8283
link: https://twitter.com/pypi
8384
- icon: material/rss
8485
link: https://blog.pypi.org/feed_rss_created.xml
85-
# See https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/
86+
# See https://material-plausible-plugin.ale.sh
8687
analytics:
87-
provider: google
88-
property: G-4L9L0H79CY
88+
provider: plausible
89+
domain: blog.pypi.org
90+
src: https://analytics.python.org/js/script.outbound-links.js
8991

9092
site_url: https://blog.pypi.org/
9193
repo_url: https://github.com/pypi/warehouse

docs/mkdocs-user-docs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ docs_dir: user
33
site_dir: user-site
44
plugins:
55
- search
6+
- material-plausible
67
- macros:
78
module_name: user/main
89
j2_block_start_string: "<!--[[%"
@@ -50,6 +51,10 @@ theme:
5051
extra_css:
5152
- stylesheets/extra.css
5253
extra:
54+
analytics:
55+
provider: plausible
56+
domain: docs.pypi.org
57+
src: https://analytics.python.org/js/script.outbound-links.js
5358
homepage: https://pypi.org
5459
social:
5560
- icon: fontawesome/brands/github

requirements/docs-blog.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
material-plausible-plugin
12
mkdocs
23
mkdocs-material
34
mkdocs-rss-plugin

requirements/docs-blog.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ markupsafe==3.0.2 \
309309
# via
310310
# jinja2
311311
# mkdocs
312+
material-plausible-plugin==0.3.0 \
313+
--hash=sha256:31c872608bfa4e94ef05c128f7bf1e476c55b0576ba418a983977a75216d10cc \
314+
--hash=sha256:4e1cbaf0eef86dbd34fafa2f25830960416c989f80e0b1d1fabceed6cf6b40aa
315+
# via -r requirements/docs-blog.in
312316
mergedeep==1.3.4 \
313317
--hash=sha256:0096d52e9dad9939c3d975a774666af186eda617e6ca84df4c94dec30004f2a8 \
314318
--hash=sha256:70775750742b25c0d8f36c55aed03d24c3384d17c951b3175d898bd778ef0307
@@ -320,6 +324,7 @@ mkdocs==1.6.1 \
320324
--hash=sha256:db91759624d1647f3f34aa0c3f327dd2601beae39a366d6e064c03468d35c20e
321325
# via
322326
# -r requirements/docs-blog.in
327+
# material-plausible-plugin
323328
# mkdocs-material
324329
# mkdocs-rss-plugin
325330
mkdocs-get-deps==0.2.0 \
@@ -329,7 +334,9 @@ mkdocs-get-deps==0.2.0 \
329334
mkdocs-material==9.6.11 \
330335
--hash=sha256:0b7f4a0145c5074cdd692e4362d232fb25ef5b23328d0ec1ab287af77cc0deff \
331336
--hash=sha256:47f21ef9cbf4f0ebdce78a2ceecaa5d413581a55141e4464902224ebbc0b1263
332-
# via -r requirements/docs-blog.in
337+
# via
338+
# -r requirements/docs-blog.in
339+
# material-plausible-plugin
333340
mkdocs-material-extensions==1.3.1 \
334341
--hash=sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443 \
335342
--hash=sha256:adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31

requirements/docs-user.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
material-plausible-plugin
12
mkdocs
23
mkdocs-material
34
mkdocs-macros-plugin

requirements/docs-user.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ markupsafe==3.0.2 \
215215
# via
216216
# jinja2
217217
# mkdocs
218+
material-plausible-plugin==0.3.0 \
219+
--hash=sha256:31c872608bfa4e94ef05c128f7bf1e476c55b0576ba418a983977a75216d10cc \
220+
--hash=sha256:4e1cbaf0eef86dbd34fafa2f25830960416c989f80e0b1d1fabceed6cf6b40aa
221+
# via -r requirements/docs-user.in
218222
mergedeep==1.3.4 \
219223
--hash=sha256:0096d52e9dad9939c3d975a774666af186eda617e6ca84df4c94dec30004f2a8 \
220224
--hash=sha256:70775750742b25c0d8f36c55aed03d24c3384d17c951b3175d898bd778ef0307
@@ -226,6 +230,7 @@ mkdocs==1.6.1 \
226230
--hash=sha256:db91759624d1647f3f34aa0c3f327dd2601beae39a366d6e064c03468d35c20e
227231
# via
228232
# -r requirements/docs-user.in
233+
# material-plausible-plugin
229234
# mkdocs-macros-plugin
230235
# mkdocs-material
231236
mkdocs-get-deps==0.2.0 \
@@ -239,7 +244,9 @@ mkdocs-macros-plugin==1.3.7 \
239244
mkdocs-material==9.6.11 \
240245
--hash=sha256:0b7f4a0145c5074cdd692e4362d232fb25ef5b23328d0ec1ab287af77cc0deff \
241246
--hash=sha256:47f21ef9cbf4f0ebdce78a2ceecaa5d413581a55141e4464902224ebbc0b1263
242-
# via -r requirements/docs-user.in
247+
# via
248+
# -r requirements/docs-user.in
249+
# material-plausible-plugin
243250
mkdocs-material-extensions==1.3.1 \
244251
--hash=sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443 \
245252
--hash=sha256:adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31

tests/unit/test_csp.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,6 @@ def test_includeme():
250250
"https://api.github.com/repos/",
251251
"https://api.github.com/search/issues",
252252
"https://gitlab.com/api/",
253-
"https://*.google-analytics.com",
254-
"https://*.analytics.google.com",
255-
"https://*.googletagmanager.com",
256253
"https://analytics.python.org",
257254
"fastly-insights.com",
258255
"*.fastly-insights.com",
@@ -269,17 +266,12 @@ def test_includeme():
269266
"img-src": [
270267
"'self'",
271268
"camo.url.value",
272-
"https://*.google-analytics.com",
273-
"https://*.googletagmanager.com",
274269
"*.fastly-insights.com",
275270
"*.ethicalads.io",
276271
"ethicalads.blob.core.windows.net",
277272
],
278273
"script-src": [
279274
"'self'",
280-
"https://*.googletagmanager.com",
281-
"https://www.google-analytics.com",
282-
"https://ssl.google-analytics.com",
283275
"https://analytics.python.org",
284276
"*.fastly-insights.com",
285277
"*.ethicalads.io",

warehouse/config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,6 @@ def configure(settings=None):
399399
maybe_set(settings, "camo.url", "CAMO_URL")
400400
maybe_set(settings, "camo.key", "CAMO_KEY")
401401
maybe_set(settings, "docs.url", "DOCS_URL")
402-
maybe_set(settings, "ga.tracking_id", "GA_TRACKING_ID")
403-
maybe_set(settings, "ga4.tracking_id", "GA4_TRACKING_ID")
404402
maybe_set(settings, "statuspage.url", "STATUSPAGE_URL")
405403
maybe_set(settings, "hibp.api_key", "HIBP_API_KEY")
406404
maybe_set(settings, "token.password.secret", "TOKEN_PASSWORD_SECRET")

warehouse/csp.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ def _connect_src_settings(config) -> list:
9898
"https://api.github.com/repos/",
9999
"https://api.github.com/search/issues",
100100
"https://gitlab.com/api/",
101-
"https://*.google-analytics.com",
102-
"https://*.analytics.google.com",
103-
"https://*.googletagmanager.com",
104101
"https://analytics.python.org",
105102
"fastly-insights.com",
106103
"*.fastly-insights.com",
@@ -135,9 +132,6 @@ def _connect_src_settings(config) -> list:
135132
def _script_src_settings(config) -> list:
136133
settings = [
137134
SELF,
138-
"https://*.googletagmanager.com",
139-
"https://www.google-analytics.com", # Remove when disabling UA
140-
"https://ssl.google-analytics.com", # Remove when disabling UA
141135
"https://analytics.python.org",
142136
"*.fastly-insights.com",
143137
"*.ethicalads.io",
@@ -177,8 +171,6 @@ def includeme(config):
177171
"img-src": [
178172
SELF,
179173
config.registry.settings["camo.url"],
180-
"https://*.google-analytics.com",
181-
"https://*.googletagmanager.com",
182174
"*.fastly-insights.com",
183175
"*.ethicalads.io",
184176
"ethicalads.blob.core.windows.net",

0 commit comments

Comments
 (0)