Tutorial · cloudflare · Published 2026-08-15 · 3 min read

Cloudflare Web Analytics basics

Add Cloudflare Web Analytics with a JS beacon or the proxy. What the free privacy-first metrics cover and how it compares to Google Analytics.

What Cloudflare Web Analytics is

Cloudflare Web Analytics is a free analytics service that records page views and visitor metrics from the browser using the Performance API, with no cookies and no cross-site fingerprinting. It is distinct from the account-level Cloudflare Analytics logs, which are server-side and count raw requests including bots and spam. The client-side Web Analytics beacon reports real user behaviour, so the visitor counts reflect actual page loads rather than every edge request.

Because it stores no personal data and creates no cross-site identifier, it is often the tool a privacy-conscious site adds instead of a heavier analytics SDK. It works for any site, proxied or not, by injecting a small JavaScript snippet.

Add the beacon

  1. Log in to the Cloudflare dashboard and open Analytics > Web Analytics.
  2. Add a site and choose the JavaScript snippet delivery. If the domain is already proxied through Cloudflare, metrics can be collected from the edge; otherwise you add the beacon.
  3. Copy the generated script and place it on every page you want to measure, usually just before the closing </body> tag or in the shared layout.
<script defer src="https://static.cloudflareinsights.com/beacon.min.js"
  data-cf-beacon='{"token": "YOUR_TOKEN"}'>
</script>
  1. Reload the page, then open the Web Analytics dashboard and confirm the first page view appears. The beacon uses the Performance API, which is available in all modern browsers, so no extra tracking library is needed.

What the metrics cover

The dashboard shows page views, top hostnames and paths, visitor countries, and per-path performance compared against Core Web Vitals style thresholds. Filters slice the data by path, country, or time range, which is enough to spot a traffic spike, a slow region, or the effect of a change.

It answers "how many people loaded my page and how fast was it" well. It does not include events, goals, funnels, or long-term audience history the way a dedicated analytics product does. If you need conversion tracking or deep behaviour analysis, plan for a separate tool rather than expecting an analytics side feature to replace it. Pair the traffic view with the Search Console performance report to see the same pages from the search side and PageSpeed Insights for lab metrics.

Privacy is the point, and the limitation

No cookies, no fingerprinting, no cross-site tracking means the data is compliant without a cookie banner, but it also means you cannot tie a visitor to a browsing history or retarget them. That trade-off is deliberate. If a stakeholder expects ad-level attribution, set expectations: Web Analytics reports aggregate usage, not individual journeys.

The free tier has no reporting rows cap that blocks a normal site, but heavy sites should verify their retention window in the dashboard rather than assuming indefinite history.

When to use it

Choose Cloudflare Web Analytics when you want a light, compliant visitor count and page performance overview with no extra script weight or cookie consent overhead. Move to a dedicated analytics platform when you need goals, conversion events, or long-range funnels. Either way, keep the beacon loading without blocking render: the defer attribute handles that in the example above.

Need a website built, fixed, optimised, migrated or replaced?

This technical resource is written by CSMBAC, a small design and development studio. If you would rather hand the problem to a professional, the website service page explains how we build enquiry-ready websites.

Explore website services