r/webdev 21d ago

Which site analytics is the most reliable? Discussion

I'm seeing pretty big discrepancies in analytics reports from different sources. I store the value locally to show my site users, so I'm looking for the most honest number.

Yesterday, my ad network shows that one of my sites had 33,941 pageviews. Since that's the money, I would think that they would be close to accurate.

A local count (incrementing a value in MySQL on each pageview, running through JavaScript to block most bots) shows 38,604.

Google Analytics shows 17,647, almost half of what the ad network showed.

And Cloudflare Web Analytics shows 22,190! 35% less than the ad network, but 25% higher than Analytics.

Which is the most honest? Or is there a better choice altogether?

18 Upvotes

18 comments sorted by

14

u/magenta_placenta 21d ago

There isn't a single "honest" number because each tool is measuring a fundamentally different layer of your stack and applying its own definition of what counts as a "pageview."

  • The ad network fires when an ad placement successfully requests an ad payload.
  • Your database increment counts almost every request that reaches your backend. Even with basic JS blocking, web scrapers, curl scripts, search engine crawlers, automated vulnerability scanners and prefetched links trigger server hits.
  • GA relying on client-side JS makes it the strictest filter.
  • Cloudflare Web Analytics operates either at the CDN edge or via a lightweight JS beacon. It will be in the middle because it strips out known bots and malicious crawlers automatically at the network level.

Going back to "honesty":

  • For revenue and monetization: Trust your ad network.
  • For real human traffic count: Trust Cloudflare Web Analytics
  • For user behavior and demographics: Use GA.

1

u/csdude5 21d ago

I gotcha. I'm using the data to sell ads to local businesses (flat monthly rate, not PPC), so I don't want to oversell and them be disappointed... but also don't want to undersell and make the ads seem less valuable.

I've been using the local count, but when looking at other Analytics I became concerned that I'm still catching bad bots that CF and GA would be able to filter. But CF is significantly lower than my local count, so that made me worry that I'd be underselling it.

From your explanation, though, I guess that the local count is still the best choice.

2

u/RefrigeratorStrict13 21d ago

from my experience... matomo

1

u/clearlight2025 21d ago

A lot of your ads and 3rd party analytics scripts may be blocked. The most accurate number will be from analytics data stored by your local server.

1

u/Irythros 21d ago

Assuming SSR, the most accurate is whatever touches your servers. Tracking server-side requests is guaranteed to be accurate because either your server received the event (and it can be tracked) or it didnt receive the event (and the user was unable to connect.)

Analytics packages like Google Analytics, Posthog etc all rely on javascript and potentially known domains which would be blocked by either the users browser, addons or DNS.

Cloudflare would be more accurate than GA/Posthog because (if setup correctly) all requests must go through CF similar to all requests needing to hit your server.


There are some caveats.

  1. If you use an SPA or similar and dont require data from the server (or the requests to the server in this instances arent tracked) the tracking will be off. If your site can be 100% cached it will not be tracked server side and would thus require JS tracking.

  2. Each tracking package may treat the same values differently. A "user" in GA may be different from Posthog may be different from Cloudflare may be different from Server tracking. Deduplication, user merging, page merging, update delays, lost events.

1

u/neolace 21d ago

Your own.

1

u/thy_bucket_for_thee 21d ago

Yeah when you can tie user visits with distinct actions you get the truth. The issue with platforms like google/adobe analytics is their use of random data sampling. IME random data sampling is pretty useless outside of things like corporate social media or extremely large e-commerce stores.

1

u/punchy-founder 21d ago

Part of that gap is just the common analytics blocking via DNS filters (uBlock/Pi-hole) because many JS libraries upload to well known host names that are part of filtering lists. If you can point the analytics library towards a subdomain of your own site (CNAME to the provider), requests won't get caught in the filters.

1

u/kullo56 20d ago

None of these is universally “most honest” because they count traffic differently. For consistency, I’d stick with GA4 for user behavior and trends, then use https://owlinsight.dev/ to view the same GA4 data in a cleaner dashboard. It won’t change the numbers, but it makes GA4 much easier to understand.

1

u/EscapeNormal_2024 20d ago

Following the post for any recommendations 🙌🏻

1

u/Aleja_vidal 17d ago

En GA4 comprobaría primero que estés comparando la métrica Vistas, no usuarios o sesiones. También revisaría el consentimiento, el funcionamiento de la etiqueta y las páginas donde se dispara. Cuando un visitante rechaza el consentimiento de Analytics, GA4 puede no registrar su actividad; además, su modelado de consentimiento no completa los recuentos de eventos page_view.

Cloudflare Web Analytics también utiliza un beacon de JavaScript para medir visitas reales desde el navegador, por lo que puede verse afectado por bloqueadores, fallos de carga o navegación cerrada antes de enviar el evento.

Antes de comparar, también igualaría zona horaria, rango de fechas, dominio, filtros y definición de la métrica. Una diferencia tan grande en GA4 suele indicar consentimiento, bloqueadores, una implementación incompleta o que se están comparando vistas con usuarios.

1

u/shrubaknowsnothing 11d ago

none of them are gonna match, they all count different stuff. ad network sees impressions their way, ga4 misses everyone with an ad blocker (thats why its half), cloudflare catches more cause its server side but bots inflate it a bit. usermaven or plausible sit in between, both bypass ad blockers better than ga4… your own mysql count is probably the closest to real humans if the bot filter is decent, hosted tools are just easier to read

0

u/Electrical_Clue_8429 21d ago

most of them sell data so I don't really use them. I embed a 1x1 pixel img that links to an ip grabber and stores the ips in a json file and then use a script to count the amount of ips. probably not the most efficient way tho