From 58 to 100 on PageSpeed: What Actually Fixed My Core Web Vitals

PerformanceCore Web VitalsCase Study

When I rebuilt this website, the first PageSpeed run was humbling: 58 on mobile and 56 on desktop, with a Largest Contentful Paint of 6.6 seconds. For someone who sells performance work, that is not a good look. This post shows exactly what was wrong, what I changed, and the numbers before and after. The lessons apply directly to Magento storefronts, because the causes were the same ones I find in store audits.

How this was measured: Lighthouse 12.2.1 (the engine behind PageSpeed Insights) with its default simulated mobile profile and the desktop preset. "Before" was measured on the live site; "after" on the same pages with identical settings before deployment.

The results

Metric (home page)BeforeAfter"Good" threshold
Performance score, mobile5810090+
Performance score, desktop5610090+
Largest Contentful Paint, mobile6.6 s1.7 s2.5 s or less
Largest Contentful Paint, desktop6.1 s0.4 s2.5 s or less
Total Blocking Time, mobile190 ms0 ms200 ms or less
Cumulative Layout Shift0.0020.0030.1 or less
DOM elements1,517786under 800 recommended
Accessibility score89100
SEO score92100

Layout shift was already fine. Everything else came down to a handful of specific causes.

1. The biggest win: the hero text was invisible

The hero heading and intro faded in with a CSS animation that started at opacity: 0. It looked smooth, but Chrome does not count an element as painted while it is fully transparent, so LCP waited for the animation to finish. Lighthouse even failed to identify the LCP element.

The fix kept the motion and dropped the fade:

/* before: hides the LCP element until the animation ends */
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } }

/* after: still slides in, but is painted from the first frame */
@keyframes riseIn { from { transform: translateY(18px); } }

On Magento I see the same problem with hero sliders that fade in their first slide, and with lazy-loaded main product images. If your LCP element is hidden or lazy-loaded, nothing else you do will fix LCP.

2. Halving the DOM

The home page had 1,517 elements and 3.6 seconds of main-thread work on a simulated mid-range phone. Two things were responsible:

  • Hidden content. All 56 extension cards were in the HTML, with 44 hidden behind a "Show all" button. I now render the 12 featured cards and link to the full catalogue page.
  • An icon sprite on every page. Every page carried all 68 SVG icons. The build now includes only the icons a page actually uses, and merges multi-path icons into a single path.

Magento stores hit the same issue through mega menus that print the whole category tree, and through product listings with many hidden swatches.

3. Loading Google Tag Manager after the page

Google Tag Manager was 179 KB, of which Lighthouse reported 75 KB as unused, and it competed with the page during load. It now loads on the visitor's first scroll, tap or key press, or 3.5 seconds after the page has finished loading:

['scroll','pointerdown','keydown','touchstart'].forEach(function (e) {
  addEventListener(e, loadGtm, { once: true, passive: true });
});
addEventListener('load', function () { setTimeout(loadGtm, 3500); });

The trade-off is honest: a visitor who leaves within about three seconds without touching the page is not recorded in analytics. For most businesses that is acceptable; for some it is not, so decide deliberately.

4. Right-sized images

  • The logo was a 405 px PNG shown at 188 px. It is now a WebP at twice the display size, for sharp high-density screens.
  • Screenshot slider thumbnails were downloading the full 1200 px images to show them at 112 px. Proper 240 px thumbnails and an 800 px size for phones saved up to 180 KB per extension page.
  • Photos now use srcset with 480, 660 and 800 px versions, so phones download the smallest one that looks sharp.

5. Fonts: self-hosted, fewer and preloaded

I moved from Google Fonts to self-hosted variable WOFF2 files, preloaded the two that render above the fold, and dropped a third font that was only used for code blocks (the system monospace font is fine there). That removed two third-party connections and about 40 KB.

6. Breaking up one long JavaScript task

The site's own script set up everything at once (scroll effects, counters, sliders, filters), producing a 240 ms task on the main thread. Each feature now starts in its own idle-time task:

const later = fn => ('requestIdleCallback' in window
  ? requestIdleCallback(fn, { timeout: 1000 })
  : setTimeout(fn, 1));

Total Blocking Time went from 190 ms to 0 ms on mobile.

7. Accessibility fixes that also lifted SEO

  • White text on the bright brand orange had a contrast ratio of 3.3:1, below the 4.5:1 minimum, so buttons now use a slightly deeper orange (4.7:1).
  • Headings skipped levels (h2 straight to h4), which I corrected.
  • Six "Learn more" links now include hidden text saying what they lead to, which fixed the SEO audit's "links do not have descriptive text" warning.

What did not matter

Minifying CSS saved 2 KB and changed nothing measurable. Server response time (TTFB) depends mostly on the hosting edge network rather than the site. And the lab score is not the same as the Core Web Vitals badge in Search Console, which uses 28 days of real Chrome user data and only updates as visits come in.

What this means for a Magento store

Magento stores usually have more to fix than a static site, but the order of work is the same: make the LCP element visible and not lazy-loaded, cut the DOM and JavaScript, right-size images, and keep third-party scripts off the critical path. My Magento performance checklist covers the server-side items, and if your store needs the same treatment, see my performance optimization service.

Sources

Sukumar Gorai

Sukumar Gorai

Adobe Certified Magento Expert and Technical Lead with 15+ years of experience and 62 extensions on the Adobe Commerce Marketplace. More about me →

Need help with this?

Server, caching, database and frontend tuning for faster pages and better Core Web Vitals.

Performance Optimization
Available for new projects

Have a Magento project in mind?

Tell me about your store and what you need. I reply to every enquiry within one business day.

Adobe Certified Expert

Adobe Commerce Developer certification, verified on Credly.

15+ years of Magento

From Magento 1 to Magento 2.4.x, Adobe Commerce and Hyvä.

62 Marketplace extensions

Each one reviewed and approved by Adobe.