Home/Blogs/Edge (Cloudflare) vs Client (PostHog) Analytics

Edge (Cloudflare) vs Client (PostHog) Analytics

5 min read26 views

A few days ago, I enabled Cloudflare DNS proxying for great-ui.com. Soon after, I received an automated email from Cloudflare alerting me that the site had crossed 10,000 pageviews. Seeing that notification out of nowhere immediately made me worry that the website was getting hit by a DDoS attack.

My first reaction was to open my PostHog dashboard to see what was happening, check error rates, and see which pages were getting hammered. But PostHog showed a completely different pageview count: 6.1k pageviews (across 1.08k unique visitors).

PostHog analytics dashboard showing 6.1k pageviewsPostHog Web Analytics Dashboard: 6.1k pageviews and 1.08k unique visitors (Sep 27 - Sep 30)

Confused by the large gap, I logged into the Cloudflare analytics dashboard to see what Cloudflare was recording. For the September 27 to September 30 window, Cloudflare reported 17.6k pageviews.

Cloudflare traffic metrics showing 17.6k pageviewsCloudflare Analytics Dashboard: 17.6k pageviews and 17.34k total visits (Sep 27 - Sep 30)

Both dashboards analyzed the exact same domain over the exact same four-day period. When I switched the DNS nameservers for Cloudflare, I knew it would count every raw HTTP GET request for a web page at the edge, while PostHog only counted pageviews when client-side JavaScript executed. Still, seeing a gap between 17,600 and 6,100 pageviews illustrates how differently the two layers measure a pageview.

To understand why this pageview difference happens, you have to look at where each tool sits in the request lifecycle.


What is a Pageview?

Depending on where measurement happens, a "pageview" means two completely different things:

  1. Edge / Network Pageview (Cloudflare): Any incoming HTTP/HTTPS request for a document path (like / or /components/button) reaching the reverse proxy. Cloudflare increments the pageview counter immediately upon receiving the request headers, regardless of who or what made the request.
  2. Client / Browser Pageview (PostHog): An event fired only after the browser downloads the HTML document, parses the DOM, downloads the JavaScript bundle, evaluates the PostHog SDK, and successfully dispatches a $pageview telemetry payload.

Where the Tracker Lives

The diagram below outlines the full client-server lifecycle and highlights where Cloudflare and PostHog capture pageview data:

Request & Response Lifecycle

Browser
User BrowserReal Visitors (DOM)
Cloudflare
Cloudflare EdgeDNS Proxy / CDN17.6k pageviews
Next.js
Next.js OriginApp Server (SSR)
PostHog
PostHog APIClient Telemetry6.1k pageviews
Bots & CrawlersAI / Scrapers / PreviewsNo JS executed

Why Pageview Counts Differ: The 17.6k to 6.1k Breakdown

When Cloudflare reports 17.6k pageviews and PostHog reports 6.1k, neither number is wrong. They are simply measuring page loads at opposite ends of the web stack.

Out of the 17,600 pageviews logged at Cloudflare's network edge:

  • Automated Crawlers & Scrapers (−8,200 / 47%): Search indexers (Googlebot, Bingbot), AI scrapers, and data center bots requesting raw HTML routes. None of these clients evaluate client-side JavaScript.
  • Social Link Previews (−2,100 / 12%): Preview bots from Twitter/X, Discord, Slack, and WhatsApp fetching page HTML to extract OpenGraph meta tags.
  • Ad-Blockers & Early Exits (−1,200 / 7%): Privacy tools (Brave Shields, uBlock Origin) blocking analytics endpoints, plus visitors closing tabs before the JavaScript bundle finished initializing.
  • Verified PostHog Pageviews (= 6,100 / 35%): Real human visitors whose browsers loaded the document, evaluated JavaScript, and successfully dispatched a verified $pageview telemetry event.

How Cloudflare Counts Pageviews

When you enable proxying in Cloudflare DNS, Cloudflare operates as a reverse proxy. Every page request passes through Cloudflare's nearest edge node before reaching your server.

Because Cloudflare counts pageviews at the network edge:

  • It counts every document request: Automated search crawlers (Googlebot, Bingbot), AI scrapers, uptime monitors, curl commands, and feed readers all register as pageviews.
  • It counts link preview bots: When someone shares a link on Twitter, Discord, Slack, or WhatsApp, the platform's preview crawler requests the page HTML to extract OpenGraph tags. Cloudflare counts this as a pageview.
  • Zero code footprint: You do not install a tracking script in your application bundle. Cloudflare gathers pageview metrics directly from edge server logs.
  • Immune to client-side blockers: Ad blockers, privacy extensions, and disabled JavaScript in browsers have no effect on Cloudflare pageview counts.

How PostHog Counts Pageviews

PostHog is a product analytics platform designed to understand user behavior inside an application. It relies on a client-side JavaScript SDK installed in your website codebase.

Because PostHog counts pageviews inside the browser runtime:

  • Requires JavaScript execution: If a request comes from a crawler, scraper, or link preview bot that does not evaluate JavaScript, PostHog never records a pageview.
  • Filters out automated traffic: Headless bots fetching raw HTML without running scripts never trigger the $pageview event.
  • Affected by ad blockers and privacy settings: Browser extensions like uBlock Origin and privacy-focused browsers like Brave block telemetry requests to analytics endpoints, preventing those pageviews from being counted.
  • Focuses on real user navigation: PostHog tracks client-side single-page app transitions (e.g. Next.js router navigations) that never make a full roundtrip to Cloudflare's edge proxy.

Cloudflare vs PostHog: Feature Comparison

Feature / Dimension
CloudflareCloudflare Edge
PostHogPostHog Analytics
Tracking LayerNetwork Edge / Reverse Proxy (L4/L7)Browser DOM Runtime (JavaScript SDK)
Pageview DefinitionEvery incoming HTTP GET document requestVerified JavaScript $pageview event
InstallationDNS nameserver proxy (zero code)Client JavaScript SDK / NPM package
Bot & Crawler TrafficCounts all scrapers, indexers, preview botsIgnored (bots never evaluate JS)
Ad-Blocker Impact100% immune (runs at network proxy)Blocked by default unless reverse-proxied
Social Link PreviewsLogged as complete pageviewsNot tracked (no DOM evaluation)
Single-Page NavigationOnly counts initial hard document loadCaptures every client-side route change
User InteractionNone (only status codes and bandwidth)Clicks, session replays, custom events
Client Bundle Overhead0 KB (server-side edge only)~40-60 KB async JavaScript payload
Primary Use CaseInfrastructure, DDoS monitoring, CDN cacheProduct analytics, funnels, user retention

Which Pageview Count Should You Trust?

Neither number is wrong; they answer different questions.

  • Trust Cloudflare pageviews when you want to measure total load on your servers, CDN caching efficiency, bandwidth costs, and raw scraping volume hitting your routes.
  • Trust PostHog pageviews when you want to know how many actual humans rendered your site, read your content, and navigated between pages.

The 11.5k difference between Cloudflare's 17.6k pageviews and PostHog's 6.1k pageviews represents the hidden volume of web crawlers, search indexers, link preview generators, and privacy-shielded visitors.

Designed & Developed by Saurabh

© 2026 All rights reserved.

Visitors#16,497

Jaipur, India --:-- -- IST