DEMONSTRATION SITE A working site running Honest Analytics, with a year of traffic behind it. Open the reports.

Counting cached pages without breaking the cache

Page caching is the largest performance win available to a WordPress site, and it is also where a lot of analytics quietly go wrong.

The reason is simple enough. A cached page is HTML written once and handed to everybody afterwards. PHP never runs, so anything counting inside PHP never sees the request. Traffic does not fall. The reporting does.

There are two honest ways round it. Count at the web server, which sees every request and knows almost nothing about it. Or count from the browser once the page has loaded, which knows plenty and misses anybody blocking scripts.

We use both and reconcile them. The server gives the floor, the browser fills in the detail. When the two disagree by more than a few per cent, that is usually a sign something upstream is caching harder than we thought, and it has caught a misconfigured CDN twice.

Tagged accessibility performance