Home > Wagento Way > How to Test Your Site Performance with Cumulative Layout Shift (CLS)

How to Test Your Site Performance with Cumulative Layout Shift (CLS)

J.P.Singh CEO at Wagento Creative LLC

Share:

Grow Your eCommerce

Tell us a little about yourself and we'll guide you through.

"*" indicates required fields

How to Test Your Site Performance with Cumulative Layout Shift (CLS)

Imagine that you’re scrolling through a website or article when the page seems to suddenly jump or shift. You might lose your place, click on the wrong link, or accidentally navigate to an entirely different page due to this inconvenient shuffling. These unexpected shifts have become common enough to earn themselves a name: cumulative layout shifts (CLS).

According to the Search Engine Journal, CLS is defined as “the unexpected shifting of web page elements while the page is still downloading.” These elements may include fonts, images, contact forms, or a wide range of other interactive content. However, retailers can take action to measure their websites’ CLS to ensure that every visitor will have a smooth, shift-free browsing experience.

Why CLS Occurs

The frustrating and sudden shifts associated with CLS can occur due to resources being loaded asynchronously or DOM elements being dynamically added to the webpage before the original content. For example, common instances of CLS can be as simple as a resized font style or an image with unspecified dimensions. Noticing CLS changes during development can be difficult, as Philip Walton and Milica Mihajila, writers for web.dev, explain:

“Personalized or third-party content often doesn’t behave the same in development as it does in production, test images are often already in the developer’s browser cache, and API calls that run locally are often so fast that the delay isn’t noticeable.”

Therefore, any major problems in CLS frequently go unchecked until users can test the site for themselves.

How to Calculate CLS

Since CLS is predicted to be a top-ranking factor for Google in 2021, testing your website’s visual stability sooner rather than later can help your site boost its rankings when the algorithm shifts. Measuring CLS includes two different metrics: impact fraction and distance fraction. Here’s how each is calculated:

  • Impact fraction. This measures how much space an unstable element takes up in the viewport, or what a visitor sees on their screen. The metric simply adds together the percentages as the image shifts to fit the screen. For example, if an element originally takes up 50% of the viewport then drops another 25%, these percentages are added together for a score of 75%, or 0.75.
  • Distance fraction. This fraction represents how much a page element moves from the original position to its final position. For instance, the distance fraction of the previous example would be 25%, or 0.25.

Once these metrics are taken, simply multiply the two numbers together to get your final CLS score. Using the numbers from the previous examples (0.75 x 0.25), the final score would equal 0.1875.

Tools to Test Your Site

Developers can use the following tools depending on whether they’d like to check the CLS in the field or in the lab. Field tools include:

Some lab tools include:

Table of Contents

Grow Your eCommerce

"*" indicates required fields

J.P.Singh CEO at Wagento Creative LLC

About the Author

JP Singh is a visionary global leader and entrepreneur with over 20 years of experience in IT, specializing in web and eCommerce strategy. As the founder of eWay Corp and the driving force behind Wagento Commerce, JP delivers innovative, technology-driven solutions that help businesses thrive in the digital era. Since founding eWay Corp in 2005, JP has expanded his global influence, championing diversity and women in leadership roles. His companies provide tailored digital solutions for small and midsize businesses worldwide. Known for his forward-thinking vision and approachable leadership, JP continues to inspire and drive success.

Talk to a Wagento
Expert Today

Talk to a Wagento
Expert Today

Related Topics

In-House vs. Agency PIM Integration: Finding the Right Fit for Your Business

Your products are the heart of your business. Shouldn’t they have a system for data centralization? PIM integration provides a powerful solution by centralizing product data, ensuring it is consistent, accurate, and ready to be distributed seamlessly across all channels. The decision to implement a Product Information Management (PIM) system is a significant milestone for […]

Magento vs SaaS eCommerce: Should You Stick with Magento or Switch?

Hello, fellow online merchants! Today, we’re diving into the debate between Magento vs SaaS eCommerce solutions. Are you considering switching from Magento to a SaaS eCommerce solution and don’t know what to do? Maybe you’ve decided to Google it, read articles, and try to figure it out on your own. As someone who has navigated […]

Your Guide to Payment Gateways

With the holiday shopping season just about to end, it’s the perfect time to start prepping for the next season with some upgrades! When upgrading your digital storefront, there are tons of things to consider, but if you’re selling products online, why not take a look at payment gateways first? What is a Payment Gateway? […]