Skip to content

chore(site): install the Web Analytics beacon by hand - #203

Merged
dvcdsys merged 2 commits into
developfrom
feat/site-web-analytics-beacon
Jul 27, 2026
Merged

chore(site): install the Web Analytics beacon by hand#203
dvcdsys merged 2 commits into
developfrom
feat/site-web-analytics-beacon

Conversation

@dvcdsys

@dvcdsys dvcdsys commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Follow-up to #201. The CSP was widened for a beacon that never arrived.

What happened

The codeindex.app zone was set up in Web Analytics with automatic
setup
— Cloudflare says it will inject the beacon into HTML at the edge.
It does not, for this site: that injection runs in the zone HTML rewriter,
which never sees responses served by Cloudflare Pages. Verified against
production — no cloudflareinsights anywhere in the live HTML minutes
after the toggle, cf-cache-status: DYNAMIC on every response.

What changed

The site is now on "Enable with JS Snippet installation", and the tag is
in both deployed HTML entry points (site/index.html,
site/docs/index.htmlsite/og/og.html is a local prop page for
rendering the OG image and is not part of the build).

The token in the snippet is public by design: it appears in the page source
of every site using Web Analytics and grants nothing. It is not a secret,
so it stays in the repo instead of becoming a build-time injection.

Test plan

  • npm run build — green; dist/index.html and dist/docs/index.html both
    carry the beacon.
  • After deploy: beacon present in the live HTML, no CSP violation in the
    browser console, and the Web Analytics dashboard starts counting.

🤖 Generated with Claude Code

dvcdsys and others added 2 commits July 27, 2026 11:30
… lines

Copy-pasting the beacon URL from the comment was broken by the mid-URL
line wrap; keep each URL and CSP directive on a single line.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Enabling Web Analytics with "automatic setup" on the codeindex.app zone
does nothing for this site: that injection is done by the zone HTML
rewriter, which never sees responses served by Cloudflare Pages. Confirmed
empirically — the beacon was still absent from the live HTML minutes after
the zone-level toggle, with cf-cache-status: DYNAMIC on every response.

Switch the site to "Enable with JS Snippet installation" and add the tag to
both deployed HTML entry points. The token is public by design (it ships in
the page source of every site using Web Analytics), so it lives in the repo
rather than in a build secret.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@dvcdsys
dvcdsys merged commit 352299f into develop Jul 27, 2026
1 check passed
@dvcdsys
dvcdsys deleted the feat/site-web-analytics-beacon branch July 27, 2026 10:31
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.

1 participant