{"id":85704,"date":"2021-09-01T10:01:19","date_gmt":"2021-09-01T17:01:19","guid":{"rendered":"https:\/\/www.bruceclay.com\/?p=85704"},"modified":"2023-08-13T16:03:16","modified_gmt":"2023-08-13T23:03:16","slug":"core-web-vitals-cls","status":"publish","type":"post","link":"https:\/\/www.bruceclay.com\/blog\/core-web-vitals-cls\/","title":{"rendered":"Core Web Vitals: Cumulative Layout Shift \u2013 What It Is and How to Improve It for SEO"},"content":{"rendered":"
With Google’s Page Experience update<\/a> now rolled out, websites that are fine-tuned have some new ranking opportunities.<\/p>\n In particular, websites can qualify for a ranking boost based on several new performance metrics Google calls \u201ccore web vitals.\u201d<\/p>\n Core web vitals are a set of core webpage functionalities that impact user experience. They now play a part in strategic SEO and can impact how websites rank in Google.<\/p>\n Google has defined three core web vitals:<\/p>\n This article is part of our series about Google\u2019s page experience update, and I’m updating it to reflect Google’s latest changes. Here I\u2019ll discuss cumulative layout shift or CLS:<\/p>\n CLS measures the formatting changes to a webpage after the initial rendering in a browser, usually by the dynamic insertion of content above what is already being shown.<\/p>\n It is generally annoying to be clicking on a link and have that link \u201cmove,\u201d resulting in a click to an unexpected location. This kind of instability of content on a webpage creates a bad user experience.<\/p>\n Google discusses CLS here<\/a>:<\/p>\n Cumulative Layout Shift (CLS) is an important, user-centric metric for measuring visual stability because it helps quantify how often users experience unexpected layout shifts\u2014a low CLS helps ensure that the page is delightful.<\/em><\/p><\/blockquote>\n Unexpected page layout shifts hurt the user experience. One example is when a button or link shifts on the webpage, causing a person to click something else. This can be really bad if it means they accidentally made a purchase, as you can see in this demo from Google<\/a>:<\/p>\n Importantly, Google clarifies<\/a> that not all layout shifts are considered bad:<\/p>\n A layout shift is only bad if the user isn’t expecting it. On the other hand, layout shifts that occur in response to user interactions (clicking a link, pressing a button, typing in a search box and similar) are generally fine, as long as the shift occurs close enough to the interaction that the relationship is clear to the user.<\/em><\/p><\/blockquote>\n Layout shifts that occur within 500 milliseconds of user input will have the hadRecentInput flag set so that they can be excluded from calculations.<\/p>\n CLS is measured by the total of all individual layout shift scores for every unexpected layout shift that occurs during a pageview’s worst “session window.”<\/p>\n A session window is any 5-second span of shifts that occur while a user visits a page. Google looks for the 5-second interval that has the most shift penalties, and that\u2019s the score for that pageview.<\/p>\n To calculate a layout shift score, Google multiplies the impact fraction<\/strong> and the distance fraction<\/strong>. I\u2019ll break these down.<\/p>\n Impact fraction<\/a> is how much viewport area an unstable element takes up between two frames.<\/p>\n In the example below, you can see that the element takes up 50% of the original viewport, but then is moved down by 25%. Between both frames, the element takes up 50% plus 25% of the viewport, causing the impact fraction to be 75%.<\/p>\n Distance fraction<\/strong><\/a> is the distance that an unstable element has moved. The example below shows that the element has moved 25% of the viewport height.<\/p>\n So to sum up: CLS is measured by the layout shift score, which is calculated this way:<\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0Impact fraction * distance fraction = layout shift score<\/em><\/strong><\/p>\n Taking the examples above, the calculation would go like so: 0.75 * 0.25 = 0.1875. Google says a webpage should maintain a CLS of less than 0.1 across all pages or page views on your site. This example would be over that goal, so it would score poorly.<\/p>\n One illustration to give you a clearer idea of how CLS is scored:<\/em> If everything inside of the viewport shifted out of the viewport in a single frame, that would have a layout score of 1.0. (See other examples on GitHub<\/a>.)<\/p>\n The more elements you have on your page that shift in the viewport, the worse your score could be.<\/p>\n You can read more about the layout shift score here<\/a> and how Google defines its thresholds here<\/a>.<\/p>\n As with the other core web vitals, CLS helps ensure that the page experience is smooth for your visitors \u2014 on both mobile and desktop.<\/p>\n A good layout shift score can help ensure users don\u2019t get frustrated with your webpage, don\u2019t accidentally click and get taken to another page, and don\u2019t mistakenly make a purchase. A good user experience<\/a> helps you achieve all the outcomes we like to see in SEO: rankings, traffic, conversions and revenue.<\/p>\n According to Screaming Frog research<\/a>, URLs in Position 1 of the search results were 10% more likely to pass the core web vitals assessment than URLs in Position 9. Of course, this data reflected existing pages \u2014 which might not have been fine-tuned to comply with core web vitals yet \u2014 before these factors applied to the ranking algorithms.<\/p>\n Looking at CLS, less than half (46%) of mobile URLs and less than half (47%) of desktop URLs had \u201cgood\u201d CLS scores. The average CLS score was 0.29 on mobile and 0.25 on desktop. In other words, there is room for CLS improvement on most sites<\/strong>.<\/p>\n Screaming Frog segmented pass rates by position, and found a decline in the percentage of \u201cgood\u201d URLs as you move down the positions on the search results page. The following example is mobile results, but they also graphed the data for desktop.<\/p>\n Google offers lab tools and field tools<\/a> to help you measure, then optimize your CLS score. For CLS, lab tools may not be as useful as the real data captured in the wild for your webpages.<\/p>\n Tools provided include:<\/p>\n Another way to measure CLS uses the web-vitals JavaScript library. You can learn more about that here<\/a>.<\/p>\n Common causes of layout shifts include:<\/strong><\/p>\n Basic principles that will improve CLS include:<\/strong><\/p>\n And check out this video about CLS from Google Chrome Developers on YouTube:<\/p>\n Want more in-depth info? Watch our on-demand webinar 3 Expert Tips to Improve Core Web Vitals<\/a> including the extended Q&A at the end.<\/em><\/strong><\/p>\n Read our entire page experience series for more information on this ranking update:<\/p>\n\n
\n
<\/a>What Is Cumulative Layout Shift (CLS)?<\/h2>\n
<\/a>How Is Cumulative Layout Shift (CLS) Measured?<\/h2>\n
\nExample of layout shift between two frames, Google Developers<\/em><\/p>\n
\nExample of distance shift in the viewport, Google Developers<\/em><\/p>\n
\nGoogle\u2019s CLS score target<\/em><\/p>\n<\/a>How Does Cumulative Layout Shift (CLS) Impact SEO?<\/h2>\n
\n\u201cHow Many Sites Pass the Core Web Vitals Assessment?\u201d screamingfrog.co.uk<\/em><\/p>\n<\/a>How Do I Improve My Cumulative Layout Shift (CLS) Score?<\/h2>\n
\n
\n
\n
\n