How to recognize a layout shift
Few people know the technical term, but everyone knows the effect. You open a page and start reading. Then an image loads at the top, and the text slides down a hand’s width. Or you want to tap “Add to cart,” and at that very moment a notice pushes in between. You hit something else.
Typical signs in a store:
- Content jumps back and forth while loading.
- A menu is briefly visible expanded although it should be closed.
- A bar or banner pushes the whole page down.
- The font changes after a moment, and lines wrap differently.
On a smartphone this is especially annoying, because even a small shift puts your thumb in the wrong place.
What the CLS score tells you
Cumulative Layout Shift is a metric from Google. It sums up how much visible content shifts unexpectedly and how far. The smaller the number, the calmer the page builds.
- Good
- A CLS score of 0.1 or less.
- Poor
- A CLS score above 0.25. In between, there is room for improvement.
- Measurement
- With real visitors, separately for mobile devices and desktop.
- Context
- Alongside load time and responsiveness, CLS is one of the three Core Web Vitals with which Google rates the usability of a page.
In the Core Web Vitals report, Search Console shows you which page types are affected. If product or collection pages are marked there as needing improvement or poor, a closer look is worthwhile.
Where the jumps in Shopify stores come from
With Shopify, the server isn’t the cause. The cause lies in the theme, the content or the apps:
- Images and videos without a fixed space. The browser doesn’t know how tall the image will be and pushes the rest down once it arrives.
- Fonts. The page first appears in a fallback font. When the actual font has loaded, line lengths and spacing change.
- App elements. Review stars, notice bars or counters are inserted into the page afterward.
- Content loaded later. Sliders, recommendations or banners appear later and displace what was already visible.
The solution is often unspectacular. If, say, a free shipping bar only appears once the rest of the page is already in place, we reserve the space for it in the theme from the start. The bar still comes a little later, but the page no longer moves.
What we do about layout shifts
- Measure. We look at the values in Search Console and PageSpeed Insights and reproduce the jumps on the affected pages.
- Find the cause. We assign each shift to an element: image, font, app or theme section.
- Fix. We give images fixed aspect ratios, reserve space for elements that load later and adjust how fonts are loaded.
- Verify. Google’s measurements are based on visits over a longer period. The report in Search Console therefore catches up only with a delay. We check directly after the change in a test and again later in the report.
When a new theme is worth more
With themes that are many years old and have been modified often, the causes are sometimes spread across the whole code. Then a theme redesign on a current foundation is the shorter route. We tell you that after the analysis, before any further effort is spent.
If the jump is tied to an app that can’t deliver its element any other way, two options remain: create space in the theme or replace the app. We show you both.
CLS and page speed go together
A store that jumps often loads slowly too, because both frequently have the same causes. That is why, in a CLS optimization, we also look at page speed.