Skip to content

Web Analytics 0.6.1: Chrome prefetches no longer count as visits

Web Analytics 0.6.1 fixes visit counts on sites that Chrome or Edge prefetch: a page fetched before anyone clicked no longer counts as a visit, and the real click is counted.

A request marked as a speculative prefetch is now stored flagged as prefetch, as a visitor of its own, so it neither starts nor joins a person’s visit. It shows only when the reports’ Bots switch is on. The visit page explains the flag. A plain <link rel=prefetch> still counts as a page view.

When Chrome serves a LiveView page from its prefetch cache, the click makes no request. The hook now counts the page on its first connect, if the app sends a few connect params from assets/js/app.js. The snippet is in the README’s installation steps. The client script also waits until a prerendered page is shown before it reports or records anything.

Smaller fixes: staff networks expire by their latest local sign-in, and live navigation keeps the signed-in user current.

Upgrading

Add the connect params from the README to app.js to count LiveView pages served from the prefetch cache.

Full release notes: Web Analytics 0.6.1

0.6.1 · 10 October 2026

Fixed

  • Chrome’s speculative prefetch no longer shows up as a visit, and the visitor it was fetched for is counted. A request marked Sec-Purpose: prefetch… / Purpose: prefetch is stored flagged "prefetch" (visible under the reports’ Bots switch, whatever Record bot traffic says), as its own visitor, so a prerender sent from a person’s own browser neither starts nor joins their visit. A <link rel=prefetch> is still a page view.
  • A LiveView page served from Chrome’s prefetch cache is counted. The click makes no request, so the hook counts the first connect when the host sends the nav_delivery / prerendered / prerendering / doc_referrer connect params (snippet in PhoenixKitWebAnalytics.LiveHook and the README’s Installation step 5). It counts as JavaScript evidence for the “no JavaScript” bot judgement.
  • The client script holds its reports and session recording of a prerendered page until it is shown, so a page nobody opened sends nothing.
  • The visit page says why a prefetch is flagged (en/et/ru).
  • Staff-network expiry now follows every local staff sighting, while broadcasts keep their existing interval. Shortening the timeout no longer forgets a network with recent local activity. Concurrent sightings keep the newest time.
  • LiveView navigation updates the open page’s signed-in user, so the live list and the new page’s leave use its current identity.
  • HexDocs source links use the repository’s v-prefixed tags; documentation no longer links to hidden modules or a removed historical function.

Changed

  • AGENTS.md records the prefetch rules.

Web Analytics 0.6.1. Install or update: {:phoenix_kit_web_analytics, "~> 0.6"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.