demo · v141

Analytics Double-Count

Concrete impact of the header rename: an analytics tag that suppressed page-view beacons on prefetched requests by sniffing Purpose: prefetch server-side will silently start firing on every prefetch in Chrome 141. This concept simulates a week of traffic for both code paths so you can see the inflation factor.

checking support…

before 141 — middleware sees Purpose: prefetch, suppresses beacon

after 141 — middleware no longer matches, prefetches count as page views

after migration — same middleware updated to check Sec-Purpose too

the silently broken middleware

// Looks fine. Was fine, pre-141.
function isPrefetch(req) {
  return req.headers["purpose"] === "prefetch";
}

// Pageview beacon
app.get("/article/:id", (req, res) => {
  if (!isPrefetch(req)) analytics.track("pageview", { id: req.params.id });
  // …serve article
});

// Chrome 141: req.headers.purpose is undefined. analytics.track fires for every prefetch.
// Migration: add ?? req.headers["sec-purpose"]?.includes("prefetch")

why this angle

The Fetch spec rename is technically a clean win, but the operational consequence on the analytics pipeline is what makes site owners actually care. Inflated page-view counts mean wrong KPIs, wrong A/B test conclusions, wrong ad inventory. The simulation here is configurable so a reader can plug in their own daily-navigation volume and see the magnitude of the bug they probably have today.

see also