Notes

A page that measures its readers says what it cost

The juudd landing page used to load in one request with nothing leaving its origin. Then we added one analytics tag and wrote down exactly what that spent.

The juudd landing page carries one analytics tag, and that tag spent a property the page used to have: nothing on it left our own origin. We took the trade knowingly, bounded it three ways, and wrote the cost down where a reader of the repository will meet it.

That is the decision. The rest of this post is why the page was built that way, why we spent the property anyway, and what we kept.

What the page used to promise

The landing page was built as one request. No framework bundle, no fonts, no images, nothing fetched from anywhere else. The argument was simple: a page whose claim is that it loads before somebody changes their mind cannot open by shipping a hydration bundle. We measured that property twice while the page grew to four times its first size, and both times the sentence that mattered still held.

What stood against it

Nobody knew whether anyone read the page. Not how many arrived, not which of its pages they left from, not whether the one section with a job to do, the quick connect section, was reached at all.

Every decision about the page had been made on taste and argument. That was affordable while the page was being built. It stops being affordable the moment the question becomes which half of the page is doing the work, because taste does not answer that and rewriting the copy cannot either.

The zero-subresource property was never the goal. It was evidence for the goal, which is a page that arrives fast and works. The question was whether measurement could be bought without spending the goal itself.

What we decided

Google Analytics 4, on every page, as two tags in the document head: an async loader and three inline lines that configure it. They sit in the head of the whole site rather than in the app component, because the error page is rendered instead of the app. A tag set only in the app is a tag the 404 page does not get, and a 404 is worth counting.

Three things bound it:

  • Production builds only. A preview or a local run sends nothing. A hit from a developer's own machine is a hit somebody has to filter back out of a property whose entire value is that its numbers are small and real.
  • One variable overrides it, and empty removes both tags. A preview build, a fork, or anyone building this site who is not us sets it empty and ships the page exactly as it shipped before.
  • The default is the real identifier, not a placeholder. That is the opposite of how the site address is handled, and it is deliberate. A site address that is wrong is visibly wrong on every canonical link. Analytics that silently did not ship looks exactly like a page nobody visited. The failure worth defending against is the forgotten variable, so the forgotten variable is the measured case and the preview is the one that has to remember.

What it cost

The sentence "nothing leaves the origin" is no longer true, and no smaller version of the decision keeps it. Self-hosting the script still needs a collection endpoint this project does not run, and measuring from a server needs a server, which the landing page was built not to have. The property was real and it was spent once.

The cost has two parts, and only one of them shows in the page:

  • In the document: 244 bytes raw and about 200 bytes gzipped per page. We measured it by building the same tree twice, once with the variable empty.
  • Behind the document: the loader then fetches about 171 kB gzipped from Google, plus a beacon that reports each visit. That is many times the size of the page it measures, and no table of page sizes will ever show it.

Because the loader is async, it neither blocks the parser nor delays first paint, and every page renders and works with it blocked. The settings that stop the page shipping its own JavaScript do not touch the tag, so the page still ships none of its own. The sentence that changed is about what the page fetches, not about what it runs.

What we do not claim

Measuring is not the same as having measured. Four days after the tag went on, no number from it had been written down anywhere. The funnel it belongs to has four steps in two systems: page view and connect click are Google's, and the first authenticated call and the first deploy are the platform's own. The connect click did not exist as an event yet, because a page with no JavaScript of its own needs either an outbound click setting or a marker on the install links, and neither had been set.

So the decision records what the tag buys in principle and what had been read from it in fact, and those were not the same thing on the day it was written.

The floor

A reader who blocks trackers gets the page unchanged, and that is not a mitigation but a floor. If anything on the page ever depends on the tag having loaded, this decision has been exceeded and should be reopened.

The older records that say "one request, nothing leaves the origin" were left standing. They are what was true when they were written, and the newer record is the one that amends them. The tools and what they refuse are listed in the docs.

The rule, once

A page may spend a property it was built around, but only once, only in the open, and only with a way to switch the spending off, because an unrecorded trade reads like a bug and a recorded one reads like a decision.