All Posts
Performance 8 min read

How we took an e-commerce site from 42 to 98 on Google PageSpeed

#web-vitals#frontend#seo

A direct-to-consumer fashion brand was losing paid search traffic due to terrible mobile performance. Their mobile PageSpeed score was 42, Largest Contentful Paint (LCP) was 4.6 seconds, and Cumulative Layout Shift (CLS) was causing accidental button clicks. Here is how we engineered their score up to 98.

Fixing Largest Contentful Paint (LCP)

The hero banner image was the primary LCP culprit. It was loaded via a client-side JavaScript carousel library, which meant the browser didn't even start downloading the image until 1.8 seconds into the page load.

We implemented:

- Server-side preloading of the first hero image with `<link rel="preload" as="image" fetchpriority="high">` - Modern image formatting using WebP and AVIF with responsive `srcset` tailored to mobile viewports - Removing lazy loading on the hero image (lazy loading above-the-fold images is a common rookie mistake)

Taming third-party script bloat

The client had 14 analytics and marketing tags firing on boot: Meta Pixel, TikTok, Pinterest, Google Analytics, Hotjar, Klaviyo, and several popup tools. Together they were blocking the main thread for over 2.4 seconds (Total Blocking Time).

We migrated non-essential tracking to server-side Google Tag Manager and Partytown, running analytics scripts inside isolated Web Workers off the main thread. Essential scripts were deferred until after user interaction.

Eliminating layout shift (CLS)

CLS was 0.28 because web fonts loaded late and swapped in with different line heights (FOUT), and product image containers had no aspect-ratio reservations.

- Added `font-display: optional` with local font fallback metrics matchers - Set explicit CSS `aspect-ratio` on all image wrappers

CLS dropped to 0.002. Conversion rates on mobile devices increased by 19% in the first 30 days post-launch.

Have a similar challenge?

We build production-grade software for companies that need it done right.

Let's Talk