```","abstract":"**Symptom:** Only initial pageload counted **Fix:** Add `spa: true`: ```html ```","articleSection":"skill","datePublished":"2026-07-10T11:25:03.397Z","dateModified":"2026-07-10T11:25:03.397Z","inLanguage":"en","url":"https://claudary.paisolsolutions.com/skills/gotchas-50","mainEntityOfPage":{"@type":"WebPage","@id":"https://claudary.paisolsolutions.com/skills/gotchas-50"},"isAccessibleForFree":true,"encoding":{"@type":"MediaObject","encodingFormat":"text/markdown","contentUrl":"https://claudary.paisolsolutions.com/raw/skills/gotchas-50"},"wordCount":283,"author":{"@type":"Person","name":"Claude Code Knowledge Pack"},"publisher":{"@id":"https://claudary.paisolsolutions.com/#organization"},"speakable":{"@type":"SpeakableSpecification","cssSelector":["h1","[data-speakable]"]}},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://claudary.paisolsolutions.com/"},{"@type":"ListItem","position":2,"name":"Skills","item":"https://claudary.paisolsolutions.com/skills"},{"@type":"ListItem","position":3,"name":"Web Analytics Gotchas","item":"https://claudary.paisolsolutions.com/skills/gotchas-50"}]},{"@type":"Organization","@id":"https://claudary.paisolsolutions.com/#organization","name":"Claudary","url":"https://claudary.paisolsolutions.com","logo":{"@type":"ImageObject","url":"https://claudary.paisolsolutions.com/favicon.png"}}]}
All skills
Skillintermediate

Web Analytics Gotchas

**Symptom:** Only initial pageload counted **Fix:** Add `spa: true`: ```html <script data-cf-beacon='{"token": "TOKEN", "spa": true}' ...></script> ```

Claude Code Knowledge Pack7/10/2026

Overview

Web Analytics Gotchas

Critical Issues

SPA Navigation Not Tracked

Symptom: Only initial pageload counted
Fix: Add spa: true:

<script data-cf-beacon='{"token": "TOKEN", "spa": true}' ...></script>

CSP Blocking Beacon

Symptom: Console error "Refused to load script"
Fix: Allow both domains:

script-src 'self' https://static.cloudflareinsights.com https://cloudflareinsights.com;

Hash-Based Routing Unsupported

Symptom: #/path URLs not tracked
Fix: Migrate to History API (BrowserRouter, not HashRouter). No workaround for hash routing.

No Data Appearing

Causes & Fixes:

  1. Delay - Wait 5-15 minutes
  2. Wrong token - Verify matches dashboard exactly
  3. Script blocked - Check DevTools Network tab for beacon.min.js
  4. Domain mismatch - Dashboard site must match actual URL

Auto-Injection Fails

Cause: Cache-Control: no-transform header
Fix: Remove no-transform or install beacon manually

Duplicate Pageviews

Cause: Multiple beacon scripts
Fix: Keep only one beacon per page

Configuration Issues

IssueFix
10-site limit reachedDelete old sites or proxy through CF (unlimited)
Token not recognizedUse exact alphanumeric token from dashboard

Framework-Specific

Next.js Hydration Warning

<script suppressHydrationWarning ... />

Gatsby Window Undefined

Use gatsby-browser.js to load client-side only.

Limits

ResourceLimit
Non-proxied sites10
Proxied sitesUnlimited
Data retention6 months
Ingestion delay5-10 min
API accessNone (dashboard only)

When NOT to Use Web Analytics

Use alternatives if you need:

  • Custom event tracking
  • Real-time data
  • User-level tracking
  • Conversion funnels
  • Data export/API access

Web Analytics excels at: Core Web Vitals, basic traffic, privacy compliance, free unlimited pageviews.