Repository navigation
feat(website): load Cloudflare Web Analytics beacon on production docs (#692) - #695
Merged
tbolis-at-mulesoft merged 1 commit intoSep 29, 2026
Merged
Conversation
#692) Render the cookie-less beacon from the root layout only when the build receives a well-formed 32-hex NEXT_PUBLIC_CF_WEB_ANALYTICS_TOKEN, supplied by the Pages workflow from the CF_WEB_ANALYTICS_TOKEN repository variable. Local and unconfigured builds ship no analytics. The gate is unit-tested with node --test and runs in the docs CI job. Refs Donkey-Development-Kit/donkey-development-kit-metrics#19 Co-authored-by: Cursor <cursoragent@cursor.com>
tbolis-at-mulesoft
deleted the
feat/692-cloudflare-web-analytics-beacon
branch
September 29, 2026 20:57
This was referenced Oct 2, 2026
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.
Loads the cookie-less Cloudflare Web Analytics beacon on the production docs site so documentation usage can be measured (tracked end to end in Donkey-Development-Kit/donkey-development-kit-metrics#19).
The beacon is gated on a build-time public site token.
website/lib/analytics.mjsreturns the script attributes only whenNEXT_PUBLIC_CF_WEB_ANALYTICS_TOKENis a 32-character hex token; an absent or malformed value ships no beacon, so local, preview, and unconfigured builds stay analytics-free. The Pages workflow supplies the token from the repository variableCF_WEB_ANALYTICS_TOKEN(it is public config, not a secret). CI now runs the gate's unit tests (npm test), andwebsite/README.mddocuments the setup.The beacon sets no cookies and the site stores nothing about visitors; aggregate counts are pulled server-side by the metrics repo.
Post-deploy steps
CF_WEB_ANALYTICS_TOKEN(Settings > Secrets and variables > Actions > Variables).static.cloudflareinsights.com/beacon.min.jsloads on the published site.Closes #692