WordPress
Measuring without slowing down
What a tracking script costs in Core Web Vitals, and how to avoid it.
Contents
The hidden cost of a tracking script
A tracking script is not paid for in kilobytes alone. It is paid for four times over: download, parsing, execution, and DNS resolution towards a third-party domain. That last item is the most underestimated: a DNS lookup plus a TLS handshake to a new domain routinely costs 100 to 300 milliseconds on a mobile network.
| Item | Conventional measurement | Lightweight local measurement |
|---|---|---|
| Script size | 28 to 95 KB | under 7 KB |
| Third-party domains contacted | 1 to 3 | 0 |
| Additional DNS resolution | yes | no |
| Main-thread work | 40 to 200 ms | under 5 ms |
| Observed effect on LCP | +0.1 to +0.6 s | negligible |
Why Core Web Vitals are at stake
The three signals Google uses react differently to a tracking script.
- LCP — the largest element painted. A script loaded in the head delays rendering, especially if the browser must first reach a third-party domain.
- INP — responsiveness to interaction. A script monopolising the main thread for 150 ms misses the response window for the first click.
- CLS — visual stability. A tracking script does not affect it directly, but a consent management platform does: the banner shifts the page.
The right way to load a measurement
Four rules suffice, in this order of priority.
- Serve from your own domain. No additional DNS resolution, immediate benefit from the HTTP/2 or HTTP/3 connection already established.
- Defer execution until after the content. The
deferattribute at minimum, and better still: trigger measurement onvisibilitychangeorpagehide, once the page is already painted. - One network call, with no useful response. A short
POSTvianavigator.sendBeacon, which the browser sends even if the visitor leaves, and which expects no reply to process. - Nothing in the critical rendering path. No statistic justifies delaying the text the visitor came to read.
No statistic is worth a tenth of a second of rendering. If it were, you would need a different statistic.
The page-cache trap
This is the error that distorts the most dashboards. If the counter is incremented while the HTML is generated, a page cache then serves that same already-counted HTML to thousands of visitors without ever incrementing again. You end up with a flat line that reflects nothing.
The rule is absolute: measurement must travel through a request the cache does not serve. In Lisible, a dedicated endpoint receives the measurement, and it is excluded from the cache by default on every common solution.
Checking the effect on your own site
Do not take a promise on trust — measure. The method has four steps: record the values before installing via PageSpeed Insights, install, wait twenty-eight days for field data to accumulate, then compare. Lab measurements vary too much between runs to conclude on their own.
Frequently asked questions
Is server-side measurement with no JavaScript at all possible?
Yes, by counting PHP requests, but quality degrades: you then also count bots and prefetches, and you lose reading time. A minimal JavaScript call after rendering gives a far more accurate measurement at almost no cost.
Should I disable measurement on mobile to gain speed?
No. At 7 KB with no third-party domain, the gain would be undetectable and you would lose half your audience from the measurement.
Are bots counted?
No. Known bots are excluded by user agent, and a measurement triggered by JavaScript after rendering naturally rules out most automated crawlers.
Also worth reading
A WordPress plugin to measure your visibility
The six criteria that matter when choosing a WordPress statistics plugin — and the classic traps.
A Google Analytics alternative you can actually read
What you gain and what you lose by leaving Google Analytics, and how to measure a WordPress audience without…