48d4e7bbdccd00b34ac28819ce42309488bb63cd
The dashboard site is switched to JS-snippet (manual) mode; this adds the snippet.
- src/components/CfBeacon.astro renders the owner's snippet as-is (`type="module"`,
`data-cf-beacon` with the public site token) in the <head> of BaseLayout and
ErrorLayout. Module scripts load deferred, so it stays off the first-paint path.
`type="module"` is safe: the CDN answers CORS with `*`, and the beacon falls back to
querySelector("script[data-cf-beacon]") when document.currentScript is null.
- Only production builds report: PUBLIC_CF_BEACON (astro:env, client/public) defaults
to true only when WORKERS_CI=1 and WORKERS_CI_BRANCH=main, i.e. Workers Builds on
main. CI, Lighthouse CI and branch previews render nothing. Overridable per build.
- CSP: script-src += https://static.cloudflareinsights.com, connect-src +=
https://cloudflareinsights.com (where manual-mode beacons report). The CSP guard
skips src-only scripts, and the built pages carry both hosts.
Docs: 07 §12 now documents manual mode (and why automatic must stay off — it would
double-count and inject an inline script the CSP blocks), 06 §5 lists the one external
script, 14 §2 notes it is deferred and absent from Lighthouse CI.
Verified with PUBLIC_CF_BEACON=true: 63/63 pages carry exactly one beacon tag; CSP
check ok.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Languages
TypeScript
51.9%
Astro
19.4%
Svelte
16.3%
JavaScript
9.9%
CSS
2.5%