Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/web-analytics/gotchas.md
1# Web Analytics Gotchas23## Critical Issues45### SPA Navigation Not Tracked67**Symptom:** Only initial pageload counted8**Fix:** Add `spa: true`:9```html10<script data-cf-beacon='{"token": "TOKEN", "spa": true}' ...></script>11```1213### CSP Blocking Beacon1415**Symptom:** Console error "Refused to load script"16**Fix:** Allow both domains:17```18script-src 'self' https://static.cloudflareinsights.com https://cloudflareinsights.com;19```2021### Hash-Based Routing Unsupported2223**Symptom:** `#/path` URLs not tracked24**Fix:** Migrate to History API (`BrowserRouter`, not `HashRouter`). No workaround for hash routing.2526### No Data Appearing2728**Causes & Fixes:**291. **Delay** - Wait 5-15 minutes302. **Wrong token** - Verify matches dashboard exactly313. **Script blocked** - Check DevTools Network tab for beacon.min.js324. **Domain mismatch** - Dashboard site must match actual URL3334### Auto-Injection Fails3536**Cause:** `Cache-Control: no-transform` header37**Fix:** Remove `no-transform` or install beacon manually3839### Duplicate Pageviews4041**Cause:** Multiple beacon scripts42**Fix:** Keep only one beacon per page4344## Configuration Issues4546| Issue | Fix |47|-------|-----|48| 10-site limit reached | Delete old sites or proxy through CF (unlimited) |49| Token not recognized | Use exact alphanumeric token from dashboard |5051## Framework-Specific5253### Next.js Hydration Warning5455```tsx56<script suppressHydrationWarning ... />57```5859### Gatsby Window Undefined6061Use `gatsby-browser.js` to load client-side only.6263## Limits6465| Resource | Limit |66|----------|-------|67| Non-proxied sites | 10 |68| Proxied sites | Unlimited |69| Data retention | 6 months |70| Ingestion delay | 5-10 min |71| API access | None (dashboard only) |7273## When NOT to Use Web Analytics7475Use alternatives if you need:76- Custom event tracking77- Real-time data78- User-level tracking79- Conversion funnels80- Data export/API access8182**Web Analytics excels at:** Core Web Vitals, basic traffic, privacy compliance, free unlimited pageviews.83