Blog

Why our script is 1.4 KB

A telemetry script should never be the reason a page is slow. The budget, and what we left out to keep it.

We hold the script to a budget of 1.4 KB gzipped, which fits into the first packets of a connection. Every feature has to fit in that, or replace something already there.

What is in: the three vitals, navigation timing, UTM capture, ad slot observation and a single beacon on page hide. What is out: session replay, click maps, a fetch wrapper, any form of user identification, and any dependency.

Most of the savings came from not doing work. There is no polling and no timers except the one-second viewability check. The script registers its observers once, buffers what they report and serialises a single JSON document when the page is hidden.

It is loaded with async, so it does not block rendering, and it is served with cache headers from cdn.open-telemetry.net. If anything fails, it fails silently: telemetry must never throw in your page.

← All articles