Setting the file. One moment.
Chapter 04 · Cloudflare Deploy
Subchapter 4.255
references/web-analytics/configuration.mdMarkdown2 KBView on GitHub
Dashboard → Web Analytics → Add site → Select hostname → Done
| Injection Option | Description |
|---|---|
| Enable | Auto-inject for all visitors (default) |
| Enable, excluding EU | No injection for EU (GDPR) |
| Enable with manual snippet | You add beacon manually |
| Disable | Pause tracking |
Fails if response has: Cache-Control: public, no-transform
CSP required:
script-src https://static.cloudflareinsights.com https://cloudflareinsights.com;Dashboard → Web Analytics → Add site → Enter hostname → Copy snippet
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
data-cf-beacon='{"token": "YOUR_TOKEN", "spa": true}'></script>Limits: 10 non-proxied sites per account
Enable spa: true for: React Router, Next.js, Vue Router, Nuxt, SvelteKit, Angular
Keep spa: false for: Traditional multi-page apps, static sites, WordPress
Hash routing (#/path) NOT supported - use History API routing.
// Only load in production
if (process.env.NODE_ENV === 'production') {
// Load beacon
}Or use environment-specific tokens via env vars.
cloudflareinsights → see beacon.min.js + data requestConfigure in dashboard for: