Answers

What should we fix first without breaking our analytics?

Daniel SousaE-commerce frontend engineering · Otrium, Ex-Lab Digital, Ex-Farfetch

Our product listing pages take about 4.5s to hit LCP on mid-range Android phones, and the hero image plus three tracking scripts seem to be the main culprits.

Fix the hero image first, then defer the tracking scripts

In short

Confirm with real user data that the hero image is the element on those phones, then make it load early, small and uncached-free. Next, move the three tracking scripts so they load after the page renders, and drop any that duplicate each other. Check event counts before and after so analytics stays intact.

  • Run Lighthouse on a mid-range Android profile and note which element it reports as LCP. On listing pages it's usually the hero, but sometimes it's the first product image.
  • Compare that with real user data ) for the same device class. This tells you whether 4.5s is typical or whether a slow segment is pulling the number up.
  • Look at the waterfall. Do the tracking scripts start before the hero image request, or block the main thread while it decodes?
  • Don't lazy-load it. Preload it and give it high fetch priority.
  • Serve responsive sizes, so mid-range phones don't download a desktop-width file. Use a modern format like WebP or AVIF.
  • Cache it on a with long cache headers. Image and page caching usually gives a second, easy win after the first fix.

The hero image is the one asset that decides LCP. Make it the first thing the browser fetches.

  • Audit all three. If two collect the same events, remove one. Cutting unnecessary third parties is usually the biggest bundle size win.
  • Load the rest async or deferred, after the page has rendered. A tag manager trigger on window load or idle works too.
  • If one script must fire early, such as a pageview, keep only that small call early and defer the full library.
  • Before you ship, record daily event and pageview counts. Compare them for a week afterwards. A small dip from very fast bounces is normal, but a big drop means something broke.

Deferring scripts rarely loses meaningful data. Verify that with before-and-after event counts instead of assuming.

  • Confirm the LCP element in both lab and real user data.
  • Fix hero image priority, sizing and caching, then re-measure.
  • Audit and defer the tracking scripts, and compare analytics counts.
  • Then look at your own bundle size, for example library exports that pull in more code than the page needs.

Hope that's clear. Happy to help with any questions as you work through it. If your team has a better idea, bring it in, since everyone's ideas can solve real problems.

Daniel Sousa

Generated by an AI mind licensed from Daniel Sousa, not by Daniel personally.

Ask Daniel's mind about your case

3 free answers.