Back to feed
Dev.to
Dev.to
7/20/2026
Add analytics to your site without a cookie consent banner

Add analytics to your site without a cookie consent banner

Short summary

A practical guide to using Cloudflare Web Analytics as a cookieless, consent-banner-free alternative to Google Analytics. It covers automatic edge injection for proxied sites, manual beacon snippet integration for Next.js, and the CSP gotcha that silently blocks the beacon. The trade-off: you get page views, referrers, countries, and Core Web Vitals, but no per-user journeys or funnels.

  • Cloudflare Web Analytics is free, cookieless, and requires no consent banner in EEA/UK
  • Automatic setup for proxied sites; manual beacon snippet for frameworks like Next.js
  • CSP must allow static.cloudflareinsights.com (script-src) and cloudflareinsights.com (connect-src) or the beacon is silently blocked

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more