CLS A/B testing
.webp)
CLS (Cumulative Layout Shift) is one of the three Core Web Vitals defined by Google, and it measures the visual stability of a web page: in other words, how elements move unexpectedly during loading.
InA/B testing, CLS is a common pitfall that can skew test results or negatively impact the user experience, even if the tested variation appears to be better in substance.
π― Why it's critical in A/B testing
An A/B test aims to isolate the impact of a specific change on user behavior (clicks, conversions, etc.). But if the variation introduces a visual shift (e.g., a button that jumps, an image that pushes the content down), then:
- User interaction is disrupted: failed clicks, poor impressions, distracted attention,
- The test result becomes biased: the drop in performance is not due to the content being tested, but to the quality of technical execution.
π‘ An excessively high CLS will not be visible in traditional KPIs, but it will affect the CVR without anyone understanding why.
π§ͺ How an A/B test can cause CLS
Here are some common scenarios where a variation unintentionally triggers the CLS:
- Adding an image or HTML block without reserving space: the content "pushes" the rest of the page once loaded.
- Loading A/B test scripts via a slow tag manager (instead of direct integration into the
<head>), - Dynamic insertion of a message or promotional banner above the content without reserved space.
- Changing fonts or font weights without preloading, causing text to "jump,"
- Use of uncontrolled CSS animations (e.g., slide or fade-in effects that redraw the page).
π Direct risks in A/B testing:
- Loss of conversions on mobile devices (where visual jumps are amplified),
- Statistically significant but false results,
- Decrease in CVR with no apparent explanation,
- Rejection of the variation for the wrong reasons.
β Best CRO practices to avoid impacting CLS:
- Allow for reserved space for each block added in a variation (e.g., reserving the height of an image with CSS
aspect ratioor placeholder classes), - Avoid late injection of content with JavaScript (prefer server-side insertions or as early as possible on the client side).
- Test all variations with Lighthouse or PageSpeed Insights before deployment to check the CLS score.
- Integrate A/B test scripts directly into the code (head) to avoid flickering.
- Measure Core Web Vitals live on each variation with a tool such as Web Vitals Extension, SpeedCurve, Datadog RUM, or BigQuery + GA4.
β
.avif)
