Skip to content

Our blocking time fell to 0 ms because Lighthouse never scrolls

5 min readProTechBridge

On 8 October, a desktop PageSpeed run of one of our product pages scored 78, with 530 ms of blocking time. Later that evening, after one small change, six runs on three product pages all showed 0 ms. The pages didn't get faster. The script responsible stopped loading during the test, and the reason matters more than the score.

Google's tag was the only real script left

Our content pages ship no framework JavaScript: the build strips Next.js's client runtime from every page that doesn't need it. That left gtag.js, Google Analytics' loader, as the largest script on the page. For our tag it is about 180 KB compressed and 545 KB unpacked, and it draws nothing on screen.

We loaded it straight after the page's load event, which keeps it off the critical path but not out of the test. Lighthouse counts blocking time from first paint until the page is reliably interactive, and every task longer than 50 ms adds its excess: a 70 ms task adds 20 ms. That evening's runs, before and after the change:

Page Mobile Desktop
CogsIQ case study 20 → 0 ms 0 → 0 ms
Collabrun case study 60 → 0 ms 170 → 0 ms
Another product page 120 and 190 → 0 ms 530 and 130 → 0 ms

PageSpeed was struggling that evening, which inflates numbers like these, but in the runs we inspected the long tasks belonged to Google's tag. Desktop scores moved most: the product page went from 78 and 98 to 100, and Collabrun from 96 to 100. Mobile stayed between 96 and 99. That isn't because phones suffer less. Lighthouse judges desktop more harshly, classing up to 150 ms as good and over 350 ms as poor, against 200 and 600 ms on mobile, and blocking time is 30% of the score.

The change is a few lines, and keeps the queue

The loader now waits for the first sign of a person:

// Runs after the consent defaults and gtag('config', ...) in <head>
function loadGa() {
  var s = document.createElement('script');
  s.async = true;
  s.src = 'https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX';
  document.head.appendChild(s);
}
var events = ['scroll', 'pointermove', 'pointerdown', 'keydown', 'touchstart'];
var done = false;
function first() {
  if (done) return;
  done = true;
  events.forEach(function (e) {
    removeEventListener(e, first, { passive: true });
  });
  loadGa();
}
events.forEach(function (e) {
  addEventListener(e, first, { passive: true });
});

For a visitor who interacts, nothing is lost by waiting. Every gtag() call made before the script arrives, including the consent defaults and the config call that sends the page view, sits in the dataLayer queue, and gtag.js works through it when it loads. The order that matters for consent is unchanged: defaults first, which is the subject of an earlier post.

We tested it in headless Chrome. With nobody touching the page for four seconds, gtag.js never loaded. A mouse move, a scroll, a key press or a touch each loaded it, and the page view went out.

Lighthouse never interacts, so the cost left the test, not the page

Lighthouse loads a page and watches. It doesn't scroll, move a mouse or tap, so with this trigger gtag.js is never requested during a test. We checked with Lighthouse 13.5 against the live site, on mobile and desktop settings: Cloudflare's analytics beacon appears in the network log, Google's tag doesn't. The 0 ms isn't a faster script. It's an absent one.

Real visitors still download and run all of it, just later. On a phone, the same long tasks now land shortly after the first scroll or tap, and blocking time is the lab's stand-in for how quickly a page responds to taps. We moved the work out of the window Lighthouse measures; we didn't remove it.

There is a fair case that this is no worse for people. Before, the tag ran at the end of loading, just as visitors started reading; now it runs once they have begun. But that is an argument, not a measurement, and we have no real-visitor data to settle it. PageSpeed had none for this site at the time.

GA stops counting visitors who never touch the page

The cost lands in the data. A visitor who arrives, reads the first screen and leaves without scrolling, moving a mouse or tapping is never recorded in Google Analytics. On a desktop almost everyone moves the mouse. On a phone, it's the people who read only what loads in view and go back.

We can't tell you how many visitors that is. Cloudflare's cookieless beacon loads for everyone and still counts them, but the two tools already disagreed: Cloudflare counts people who block Google, and GA defers to consent in Europe. The gap between them can't isolate this one cause.

It also flatters a number. GA counts a session as engaged if it lasts longer than 10 seconds, has a key event, or has two or more page views, and engagement rate is the share of sessions that are engaged. Visitors who never touch the page can't reach a second page view and rarely trigger a key event, so the sessions this drops lean heavily unengaged. Engagement rate goes up on the day you ship it, with no change in how anyone behaves.

Decide by how you use GA, then check yours

We kept it because of how we use the two tools. Raw traffic comes from Cloudflare; GA is for funnels, referrers and its link to Search Console, and none of those depend on visitors who never interact. If your GA visit counts feed campaign reporting, or a conversion rate someone is judged on, the trade is worse, and a lab score is a poor reason to make it.

To check your own site:

  • Filter the DevTools Network panel for gtag, reload and don't touch anything. If the tag loads, it is inside Lighthouse's window, and the report's long main-thread tasks diagnostic names the script behind each task.
  • If you defer it, keep the consent defaults and the config call ahead of everything, run a cookieless counter alongside it for raw traffic, and record the date of the change so nobody reads the jump in engagement rate as a win.
  • Once you have real-visitor data, watch Interaction to Next Paint in the field section of the PageSpeed report. That is where any cost of the move would show up.
  • Analytics
  • Web performance
  • Lighthouse

Need a hand with this in practice?

Reading about it is one thing. If you want someone to actually do it, that is what we are for.