Article5 min read

Ways to check site traffic on WordPress, record by record

A WordPress site records its traffic in four places: the host's access log, the CDN edge, a stats plugin's database table and an analytics tag. Each sees a different set of visits, and the page cache decides which ones the plugin misses.

By Glyphex ·

Checking site traffic on WordPress starts with a choice of record, because a WordPress site writes its visits in four separate places and no two of them agree. The host's access log holds every request. The CDN's edge log holds every request that reached the edge. A statistics plugin holds every page WordPress rendered. An analytics tag holds every browser that ran its script and passed consent. The figure you get depends on which of these you open.

Record one: the host's access log

Every request to the server, page or asset, bot or person, is a line in the web server's access log, usually reachable from the hosting panel as a raw log download or, on a server you run, at a path such as /var/log/nginx/access.log. It counts crawlers, uptime checkers, the wp-cron.php calls WordPress makes to itself and the endless login attempts against wp-login.php and xmlrpc.php, so it is the highest number of the four and the least like an audience. It is also the only record that needs no JavaScript and no consent.

Record two: the CDN edge

A site behind a CDN such as Cloudflare gets a second request count at the edge, including requests the cache answered without ever reaching the origin. On a well-cached site the edge count is higher than the origin log, and the gap is the cache doing its job. Edge dashboards separate bot requests by user agent, which the origin log does not do for you.

Record three: a statistics plugin

A stats plugin hooks into the page render and writes a row to a table in the WordPress database, under the site's table prefix, each time PHP builds a page. It counts what WordPress served, which sounds right and has one large blind spot: page caching. A full-page cache, whether a caching plugin, the host's own layer or the CDN, serves a stored copy of the page without running PHP at all. Those visits never reach the plugin. The better-cached the site, the smaller the plugin's number, and the more it undercounts precisely the popular pages the cache was built for.

The same table counts logged-in editors previewing their own drafts unless the plugin is told to exclude them, and it counts crawlers that fetch uncached pages.

Record four: an analytics tag

A JavaScript tag placed in the theme header, or through a plugin that inserts it, records a pageview when a browser runs it. Cached pages are no problem, because the script runs in the browser regardless of who served the HTML. What it cannot see is any browser that blocked it, any visitor who declined a consent banner where one gates the script, and any crawler, since crawlers do not run your JavaScript. It is the record that most resembles an audience, and it is a sample of that audience whose size depends on the consent and blocking rates the site never learns.

Google Search Console as a fifth view

Search Console is not a traffic record. It reports impressions and clicks on Google's own results pages, which makes it the one source that can say how many people clicked through from Google search, independent of anything on your server. Its click count and your tag's organic search sessions will differ, and the difference is a mix of consent loss, blocked tags and timezone boundaries.

Reconciling one week

Take one week and write down four numbers for a single popular page: origin log requests for its URL, edge requests, plugin views, tag pageviews. The order they fall in tells you about the setup. Edge above origin means the cache is working. Plugin far below tag means the cache is hiding views from the plugin. Tag far below edge, after removing bots, is the consent and blocking gap, which is real and has no published size for your site.

Excluding yourself

Whichever record you rely on, take the site's own editors out of it. Tags can exclude a logged-in role or an IP; plugins have a setting for logged-in users; the log can be filtered by the office address. A site with three editors and a few hundred daily visitors is otherwise reporting its own staff as a measurable share of its audience.

Bots in each record

The origin log has all of them. The edge dashboard separates the ones that announce themselves. The plugin sees the ones that fetched uncached pages. The tag sees none. Compare the log and the tag for the same day to size the bot share, and expect it to be large.

Which record to use for which question

Server load, security and crawl budget are log questions. Cache efficiency is an edge question. Audience behaviour, referrers, landing pages and unique visitors are tag questions, read as a sample. Search performance is a Search Console question. A stats plugin answers "what did WordPress render", which is rarely the question being asked, and it answers it less well the better the cache.

Beyond all four records

No record on this list can count the visitors whose browser blocked the tag and who never fetched an uncached page, and none can recover the query behind a search click beyond what Search Console reports in aggregate. When the cache layer, the plugin or the tag changes, write the date beside the chart; the step you see the next morning belongs to the record and the readership did not move.