Skip to content

docs: load the Cloudflare Web Analytics beacon - #796

Merged
thomaspinder merged 1 commit into
mainfrom
docs/cloudflare-web-analytics
Sep 30, 2026
Merged

thomaspinder merged 1 commit into
mainfrom
docs/cloudflare-web-analytics

Conversation

@thomaspinder

Copy link
Copy Markdown
Collaborator

Motivation

We have no traffic data for the docs at gpjax.quantclimate.com. GitHub Pages serves the site through a DNS-only CNAME. Cloudflare does not proxy this traffic, so its automatic beacon injection does not reach the pages.

Solution

docs/conf.py now adds the Cloudflare Web Analytics beacon to each page through html_js_files.

  • The token belongs to the existing Web Analytics site for the quantclimate.com zone. Cloudflare matches the hostname by suffix, so that site also accepts data from gpjax.quantclimate.com. No new site is necessary.
  • The token is not a secret. The browser of each reader receives it.
  • The script attributes are the same as the snippet that Cloudflare generates for the site (type="module" and data-cf-beacon).

Verification

  • I rendered the new html_js_files block in a minimal project with the locked versions (Sphinx 9.0.4, shibuya 2026.7.12) and sphinx-build -W. The page contains this tag:
    <script data-cf-beacon="{&quot;token&quot;: &quot;…&quot;}" type="module" src="https://static.cloudflareinsights.com/beacon.min.js">
  • I did not run the full docs build locally, because it executes the notebooks. The docs job in CI does this.

After the merge

The suffix match comes from the Cloudflare Web Analytics FAQ. It is not yet tested for this site. After the docs deploy, make sure that page views for gpjax.quantclimate.com show in Web Analytics (filter by hostname).

🤖 Generated with Claude Code

https://claude.ai/code/session_015fagcMeo1LmLG2Dg3NybmQ

GitHub Pages serves the docs through a DNS-only CNAME, so Cloudflare
does not proxy the traffic and cannot inject its beacon. Add the script
through html_js_files. The token is that of the quantclimate.com Web
Analytics site, which also accepts data from its subdomains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015fagcMeo1LmLG2Dg3NybmQ
@thomaspinder
thomaspinder enabled auto-merge (squash) September 30, 2026 13:41
@github-actions github-actions Bot added documentation Improvements or additions to documentation size/s ci Continuous Integration tests labels Sep 30, 2026
@github-actions

Copy link
Copy Markdown

📖 Docs preview: https://pr-796--endearing-crepe-c2d5fe.netlify.app

Smoke render — the expensive notebooks run with reduced budgets, so
figures are not publication fidelity. /render-mode.txt says smoke.

@thomaspinder
thomaspinder merged commit ccc299b into main Sep 30, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration documentation Improvements or additions to documentation size/s tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant