Skip to content

Reports

Send POST reports every few minutes, with the counts since the last report. Never send an IP address, a user agent, a query string, a referrer or a cookie.

What it takes

Field What it holds
views Page views, as a number.
view_kinds {navigate, reload, back_forward, bfcache, prerender, noscript}.
entries, page_types Views that started a visit, and views per type of page.
not_found [{path, referrer, hits}].
redirects [{from, hits}].
bots [{path, bot, status, verified, hits}].
errors [{level, message, file, line, hits}], and one row per 5xx answer.
csp [{directive, blocked, disposition, hits}]. Only the origin of what was blocked.
lcp [{path, image, device, hits}]. The image that was painted largest.
fonts [{family, weight, style, hits}]. Font files fetched from the network. A variable font counts with the lower end of its range.
weights [{path, bytes, requests}]. What a first view, without cache, transfers. It is used for the CO₂ per visit.
checks [{name, host, result, detail, checked_at}]. Your own checks, with ok or problem.
searches [{q, lang, searches, zero, clicks}]. The own search of the site. See below.

Searches

searches counts every finished search of a person, whoever answered it. That can be your own copy, or GET search. It holds searches, of which zero found nothing, and the clicks on a result.

Do not count while someone types. Do not count suggestions on a 404, or other callers. The CMS counts nothing itself.

Per environment

view_kinds, bots, errors, fonts, weights and checks are kept per environment, and shown apart, as Live | Staging. views, not_found, redirects, csp, lcp, searches and the WebP test only come from production.

Counting views

A cached page starts no code on the server. A prerender that nobody opens does reach the server. A page from the back/forward cache never reaches it. So count with a tiny beacon, once the page is really seen:

JavaScript
(() => {
  const send = kind => { const i = new Image(); i.src = '/_v.gif?k=' + kind; };
  const nav = performance.getEntriesByType('navigation')[0];
  const first = () => send(nav && nav.activationStart > 0 ? 'prerender' : (nav ? nav.type : 'navigate'));
  if (document.prerendering) {
    document.addEventListener('prerenderingchange', first, { once: true });
  } else {
    first();
  }
  addEventListener('pageshow', e => { if (e.persisted) { send('bfcache'); } });
})();

Where the beacon goes

settings.beacon comes from GET site, per environment. It looks like {"enabled": true, "url": null}.

  • enabled: false means: send no beacon at all. That is no view, no beacon at the end of a view, no <noscript> pixel, and no WebP test. The CMS then gets no view_kinds, page_types, entries, lcp, fonts or weights from that environment. Bots and errors still come from the logs.
  • url: null means: use ours, which is /_v.gif or /_view.
  • url is the own address of the site. That is an https:// address, or a path on the site. It is checked when it is saved. It has at most 300 characters, no user or password, and no #. A query string is allowed. Send it the same GET requests, with the path of the page in p, without credentials. The CMS then gets none of it either. Add its origin to connect-src and img-src.

What caching saved

This is for Insights → Carbon → Saved. It also goes in the report. Everything is optional, and per environment. See FRONTEND.md for the details.

  • speculation gives the speculative requests and their bytes, per path, purpose and rule tag. The purpose is prefetch, prerender or prefetch_other.
  • speculation_used gives the views that came from a speculation, per path and purpose.
  • server gives the page requests from the log. Per kind, full or thin, it gives the PHP requests with their time, CPU time and peak memory.
  • bfcache_missed gives the back or forward views that were not restored, per path and with the reason of Chrome.
  • weights rows of warm views and back/forward views count too. What they did not send is what was saved.

Good to know

  • bots decide redirects. When an address changes, the CMS skips the redirect if no bot fetched the old address since bots were first reported. So only send bots when you see all of them.
  • For weights, transferSize is 0 for other origins without Timing-Allow-Origin. So third parties are counted too low.

Also called: analytics API, telemetry, beacon, RUM, web vitals reporting, server logs.

Last changed