Add Cloudflare Web Analytics to documentation site - #791
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 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".
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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