Skip to content

Add Cloudflare Web Analytics to documentation site - #791

Merged
wbarnha merged 2 commits into
masterfrom
claude/cloudflare-analytics-github-pages-tn0ad6
Aug 20, 2026
Merged

Add Cloudflare Web Analytics to documentation site#791
wbarnha merged 2 commits into
masterfrom
claude/cloudflare-analytics-github-pages-tn0ad6

Conversation

@wbarnha

@wbarnha wbarnha commented Aug 20, 2026

Copy link
Copy Markdown
Member

Description

This PR adds Cloudflare Web Analytics tracking to the published Faust documentation site by implementing a Sphinx template override.

Since the documentation is generated as a static HTML site via the Pages workflow, a custom Jinja2 template is used to inject the Cloudflare analytics snippet into every generated page. The template extends the base layout and inserts the analytics script in the footer block, preserving the theme's existing footer content.

The analytics token is specific to the Faust documentation site and will only affect the published documentation at https://faust-streaming.github.io/faust.

Test Plan

No testing needed. The template will be automatically applied during the Sphinx documentation build process. The analytics snippet is a standard Cloudflare Web Analytics implementation and will be included in all generated HTML pages.

https://claude.ai/code/session_01JEBC19ggdKCkK5sUt7UUSG

The GitHub Pages site is the Sphinx HTML tree the Pages workflow builds
and uploads from Documentation/, so there is no hand-written page to
paste Cloudflare's snippet into.  Override the theme's `footer` block --
the last block before `</body>` in the basic theme alabaster derives
from -- so the beacon lands where Cloudflare's snippet expects it on
every generated page, with `super()` preserving the theme's own footer
and GitHub banner.

docs/_templates was already on templates_path (and is what sphinx-celery
defaults to), so no conf.py change is needed for Sphinx to pick this up.
Changing a template also bumps the newest-template mtime, which makes
Sphinx rewrite every page rather than only the ones whose sources
changed, so an incremental build still picks up the beacon everywhere.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JEBC19ggdKCkK5sUt7UUSG
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.20%. Comparing base (dc690de) to head (d2f650a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #791   +/-   ##
=======================================
  Coverage   96.20%   96.20%           
=======================================
  Files         110      110           
  Lines       11789    11789           
  Branches     1281     1281           
=======================================
  Hits        11342    11342           
  Misses        350      350           
  Partials       97       97           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0806f21cbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/_templates/layout.html Outdated
Use Cloudflare's documented `defer` form instead of `type='module'`.  A
module script is deferred anyway, so the loading behaviour is unchanged,
but `document.currentScript` is null while a module executes and that is
how a beacon reads the `data-cf-beacon` token off its own tag.  The
classic form keeps the token readable however the beacon looks it up,
and additionally runs in browsers that skip module scripts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JEBC19ggdKCkK5sUt7UUSG
@wbarnha
wbarnha merged commit 181b184 into master Aug 20, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants