Cloudflare Analytics and Web Analytics
By the end of this lesson you will understand the difference between Cloudflare's built-in analytics and Web Analytics, and how to use each to monitor your site.
Two Analytics Products
Cloudflare offers two distinct free analytics products:
| Product | Data Source | Requires CF Proxy? | Privacy |
|---|---|---|---|
| Cloudflare Analytics (Dashboard) | Edge data (requests through Cloudflare) | ✅ Yes | IP-based (Cloudflare's data) |
| Web Analytics | JavaScript beacon (like Google Analytics) | ❌ No | Cookie-free, GDPR-compliant |
Cloudflare Analytics (Dashboard)
Available at Analytics → Traffic for every proxied domain. Data is collected at the edge — no JavaScript needed.
Key Metrics
| Metric | Description |
|---|---|
| Requests | Total HTTP requests served through Cloudflare |
| Bandwidth | Total data transferred (served + saved) |
| Unique Visitors | Estimated unique visitors (based on IP) |
| Threats | Blocked malicious requests |
| Page Views | HTTP 200 responses for HTML content |
| Cache Ratio | Percentage of requests served from cache |
| Status Codes | Breakdown by HTTP status (200, 301, 404, 500, etc.) |
| Countries | Traffic by visitor country |
| SSL/TLS Version | Encryption protocol distribution |
Security Analytics
Under Security → Events, you can see:
- Blocked requests and their source
- Challenge outcomes (passed/failed)
- Top attack vectors
- Bot vs human traffic ratios
- WAF rule matches (paid)
DNS Analytics
Under DNS → Analytics:
- Query volume over time
- Record types queried (A, AAAA, CNAME, MX)
- Response codes (NOERROR, NXDOMAIN)
- Top queried records
Web Analytics
Web Analytics is a separate, privacy-first analytics tool that uses a JavaScript beacon. It works on any website — even those not proxied through Cloudflare.
Why Web Analytics?
| Feature | Cloudflare Web Analytics | Google Analytics |
|---|---|---|
| Privacy | No cookies, no tracking, GDPR-compliant | Requires cookie consent, tracks users |
| Performance | Lightweight (~6KB script) | Heavier script, slows page load |
| Cost | Free (unlimited) | Free (with data sampling on GA4) |
| Accuracy | Not blocked by most ad blockers | Blocked by ~30% of users |
| Integration | Simple script tag | Complex setup with tags/triggers |
Setting Up Web Analytics
- Go to Cloudflare Dashboard → Web Analytics
- Click "Add a site"
- Enter your domain
- Add the script tag to your site:
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
data-cf-beacon='{"token": "your-token-here"}'>
</script>
Metrics Available
| Metric | Description |
|---|---|
| Page Views | Total page views with path breakdown |
| Visits | Unique sessions |
| Top Pages | Most visited pages |
| Referrers | Where visitors came from |
| Countries | Visitor geography |
| Browsers | Browser distribution |
| Devices | Desktop vs mobile vs tablet |
| Core Web Vitals | LCP, FID, CLS performance metrics |
Web Analytics automatically tracks Core Web Vitals (LCP, FID/INP, CLS), giving you insight into your site's real-world performance without additional tools.
Common Misconceptions
"Cloudflare Analytics and Web Analytics show the same data"
Reality: They measure different things. Dashboard analytics count all HTTP requests (including bots, APIs, assets). Web Analytics counts actual page views from real browsers executing JavaScript.
"Web Analytics only works on Cloudflare-proxied sites"
Reality: Web Analytics works on any website — just add the script tag. It doesn't require your domain to be on Cloudflare.
Key Takeaways
- Cloudflare Analytics (dashboard) — edge-level data for proxied domains, no code needed.
- Web Analytics — privacy-first, cookie-free analytics for any site, tracks Core Web Vitals.
- Both are completely free with no data caps.
- Use Dashboard Analytics for infrastructure metrics (requests, bandwidth, cache ratio).
- Use Web Analytics for user experience metrics (page views, referrers, devices, Core Web Vitals).
What's Next
- Continue to Cloudflare Radar to explore global internet intelligence.