Skip to main content

Cloudflare Analytics and Web Analytics

Learning Focus

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:

ProductData SourceRequires CF Proxy?Privacy
Cloudflare Analytics (Dashboard)Edge data (requests through Cloudflare)✅ YesIP-based (Cloudflare's data)
Web AnalyticsJavaScript beacon (like Google Analytics)❌ NoCookie-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

MetricDescription
RequestsTotal HTTP requests served through Cloudflare
BandwidthTotal data transferred (served + saved)
Unique VisitorsEstimated unique visitors (based on IP)
ThreatsBlocked malicious requests
Page ViewsHTTP 200 responses for HTML content
Cache RatioPercentage of requests served from cache
Status CodesBreakdown by HTTP status (200, 301, 404, 500, etc.)
CountriesTraffic by visitor country
SSL/TLS VersionEncryption 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?

FeatureCloudflare Web AnalyticsGoogle Analytics
PrivacyNo cookies, no tracking, GDPR-compliantRequires cookie consent, tracks users
PerformanceLightweight (~6KB script)Heavier script, slows page load
CostFree (unlimited)Free (with data sampling on GA4)
AccuracyNot blocked by most ad blockersBlocked by ~30% of users
IntegrationSimple script tagComplex setup with tags/triggers

Setting Up Web Analytics

  1. Go to Cloudflare Dashboard → Web Analytics
  2. Click "Add a site"
  3. Enter your domain
  4. Add the script tag to your site:
Add before </body>
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
data-cf-beacon='{"token": "your-token-here"}'>
</script>

Metrics Available

MetricDescription
Page ViewsTotal page views with path breakdown
VisitsUnique sessions
Top PagesMost visited pages
ReferrersWhere visitors came from
CountriesVisitor geography
BrowsersBrowser distribution
DevicesDesktop vs mobile vs tablet
Core Web VitalsLCP, FID, CLS performance metrics
Core Web Vitals

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