G

CLS A/B testing

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:

  1. Allow for reserved space for each block added in a variation (e.g., reserving the height of an image with CSS aspect ratio or placeholder classes),
  2. Avoid late injection of content with JavaScript (prefer server-side insertions or as early as possible on the client side).
  3. Test all variations with Lighthouse or PageSpeed Insights before deployment to check the CLS score.
  4. Integrate A/B test scripts directly into the code (head) to avoid flickering.
  5. Measure Core Web Vitals live on each variation with a tool such as Web Vitals Extension, SpeedCurve, Datadog RUM, or BigQuery + GA4.

‍

Talk to a Welyft expert

The Data-Marketing agency that boosts the ROI of your customer journeys

Make an appointment
Share this article on

Tell us more about your project

We know how to boost the performance of your digital channels.
CRO
Data
User Research
Experiment
Contact us