Start a Project
All guides

Analytics

Cloudflare Web Analytics Setup for South Africa.

Cloudflare Web Analytics is the easiest privacy-first measurement tool for South African sites. It is cookieless by design, so it does not need a POPIA banner, and it is free on every Cloudflare plan. This guide walks through adding it to a Cloudflare-proxied domain, a non-proxied site, and Shopify — plus how to read the Core Web Vitals report that matters for Google rankings on Telkom and Vumatel home fibre.

Updated 15 April 2026 · 7 min read · Cloudflare · Joshua Kaplan

Prerequisites

  • A Cloudflare account (free tier is fine)
  • Your site accessible on an apex domain with DNS records you can edit
  • For automatic install: the site proxied through Cloudflare (orange cloud)
  • For manual install: ability to inject a script into <head> (theme.liquid, layout template, etc.)

Step 1. Decide between automatic and manual install

If your domain is already proxied by Cloudflare (orange cloud in DNS), pick the automatic setup — it injects the beacon without editing HTML. If you are on Shopify, Vercel, or Netlify without Cloudflare DNS proxying, use the manual JS snippet. Web Analytics data is identical either way.

Step 2. Create the site in Cloudflare Web Analytics

Log in to dash.cloudflare.com, open Analytics & Logs > Web Analytics > Add a site. Enter the hostname (e.g. yourstore.co.za). For automatic, pick the zone. For manual, copy the token.

Step 3. Manual install: paste the beacon into <head>

Paste this one-liner just before </head>. Replace YOUR_TOKEN with the one Cloudflare issued. The beacon is ~2KB, async, and does not block rendering. It fires a single POST per page view with no cookies.

theme.liquid
<!-- Cloudflare Web Analytics -->
<script defer src="https://static.cloudflareinsights.com/beacon.min.js"
  data-cf-beacon='{"token": "YOUR_TOKEN"}'></script>
<!-- End Cloudflare Web Analytics -->

Step 4. Shopify install via theme.liquid

Shopify strips some script tags in Checkout but allows them in theme.liquid. Paste the beacon just before </head> in theme.liquid. Note: Shopify checkout pages on non-Plus plans live on checkout.shopify.com and cannot be measured — treat the missing checkout funnel as a known limitation, not a bug.

Step 5. Verify the beacon fires

Open your site in an incognito window with DevTools > Network. Filter for "cloudflareinsights". You should see a POST to https://cloudflareinsights.com/cdn-cgi/rum returning 204. If you see "Refused to connect" in console, a strict Content Security Policy is blocking it — add the domain to your CSP connect-src.

CSP header example
Content-Security-Policy: default-src 'self'; script-src 'self' static.cloudflareinsights.com; connect-src 'self' cloudflareinsights.com;

Step 6. Enable Core Web Vitals reporting

Web Analytics ships with LCP, CLS, and INP out of the box. No extra script is needed. Open the Web Vitals tab after 24 hours. Treat the 75th percentile LCP as your ranking signal — Google uses field data from Chrome, and Cloudflare's numbers track closely.

Step 7. Set up a custom event for newsletter sign-ups

Cloudflare supports lightweight custom events via the window._cfBeacon object. Fire one after a successful newsletter sign-up or quote submission. Check current Cloudflare docs for the exact track() API surface, as it has evolved.

assets/cf-events.js
form.addEventListener('submit', async () => {
  // After a successful sign-up
  if (window._cfBeacon?.track) {
    window._cfBeacon.track('newsletter_signup');
  }
});

Step 8. Compare against GA4 to find gaps

Cloudflare counts every visit with JavaScript enabled, no sampling. GA4 only counts visits where analytics_storage is granted. Expect Cloudflare to report 30 to 60 percent more sessions. If the gap is smaller, your POPIA banner accept rate is unusually high — double-check it is not auto-opting-in users.

SA gotchas

  • Cloudflare Web Analytics does not track conversions with revenue. Use it for traffic and Core Web Vitals, pair with GA4 or PostHog for revenue.
  • A strict Content Security Policy will block the beacon silently. Always test with DevTools Network before assuming data will flow.
  • Shopify checkout on Basic / Shopify / Advanced plans runs on a separate domain and is invisible to Cloudflare Web Analytics.
  • Automatic install only works when the zone uses Cloudflare DNS with proxy enabled. Registrar-only setups (DNS at Afrihost, proxy off) need the manual snippet.
  • The 24-hour delay before first data appears confuses new users. If you see "No data yet" in the morning, wait until the next day before debugging.

Frequently asked questions

Is Cloudflare Web Analytics POPIA compliant?

It is cookieless and does not collect personal information by design, which means it falls outside most POPIA consent requirements. You still need to disclose its use in your privacy policy.

Can I use Cloudflare Web Analytics instead of GA4?

For traffic, referrers, and Core Web Vitals, yes. For ecommerce revenue, user cohorts, and ad attribution, no — run both.

Does the beacon affect my PageSpeed score?

Minimally. It is ~2KB, loaded with defer, and fires after DOMContentLoaded. Expect a 0 to 2 point impact on Lighthouse Performance.

How does it compare to Plausible or Fathom for SA sites?

All three are cookieless. Cloudflare is free and includes Core Web Vitals. Plausible and Fathom have richer dashboards and outbound link tracking. Pick Cloudflare for cost, Plausible for UX.