Skip to content

feat: add Cloudflare Web Analytics - #5

Merged
fedelemantuano merged 1 commit into
mainfrom
feat/cloudflare-web-analytics
Oct 17, 2026
Merged

fedelemantuano merged 1 commit into
mainfrom
feat/cloudflare-web-analytics

Conversation

@fedelemantuano

Copy link
Copy Markdown
Contributor

Summary

Add the supplied Cloudflare Web Analytics snippet to production pages in both languages, so visits can be viewed in the Cloudflare dashboard after deployment.

Base.astro → production-only Cloudflare module → Cloudflare reporting endpoint
astro.config.mjs → allow the exact beacon script and reporting origin in CSP
README.md → document configuration, development behavior, and deployment verification

Evidence

  • Before: No analytics snippet in the shared layout; CSP blocks external scripts and reporting connections.
    After: All 18 localized production pages contain exactly one module beacon with the supplied token and matching CSP permissions. The root redirect is not tracked separately.
  • npm run verify: passed; Astro checks report 0 errors, 0 warnings, 0 hints; production build generates 19 pages. The existing generic Shiki/CSP build warning remains.
  • Chromium production-preview checks passed on Italian and English home pages, Italian search, and an article: module execution and reporting allowed by CSP, zero CSP violations, working theme toggle, search, and code highlighting. Development pages omit the beacon and make no analytics requests.
  • The CDN is unreachable from this verification environment. Browser checks used a test module at the exact beacon URL and intercepted reporting requests; they do not verify the real beacon or Cloudflare ingestion. Confirm incoming visits in the Cloudflare dashboard after merge and deployment.
  • git diff --check: passed.

Merge Danger

Door: two-way

Reverting removes the snippet and its CSP permissions. Merging triggers the existing GitHub Pages deployment.

Blast Radius: sitewide

Every localized production page loads the external analytics module. Development excludes it; production previews include it. No dependency changes.

@fedelemantuano
fedelemantuano merged commit 537287e into main Oct 17, 2026
2 checks passed
@fedelemantuano
fedelemantuano deleted the feat/cloudflare-web-analytics branch October 17, 2026 14: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