大网数据广告活动
网站运营与故障问答

Cumulative Layout Shift (CLS) Issue: How to find the cause?

· 52CE 我爱测

In Google Search Console > Core Web Vitals, I have many 'poor' pages, and the problem GSC is saying is Cumulative Layout Shift CLS. Doing a page speeds insights (PSI) analysis , shows a very poor (26%) performance for mobile: 0.5…

问题原文

原帖链接 · gvanto · CC BY-SA 4.0

In Google Search Console > Core Web Vitals, I have many 'poor' pages, and the problem GSC is saying is Cumulative Layout Shift CLS.

Doing a page speeds insights (PSI) analysis, shows a very poor (26%) performance for mobile: 0.53

Looking at this helpful post on how to diagnose the problem (see where CLS is occurring), I find the largest layout shift as follows:

(This block - call it block A - was also shown in the PSI report). In mobile mode, the sidebar on the RHS sits above block A. So I thought that according to this post, the problem was the (adsense) ad causing the shift, so I placed a fixed-size (CSS) div block around the ad, but it seems to not have solved the shifting issue. I've also ensured all images have explicit sizes set (since they're using lazy loading too).

Any help would be greatly appreciated at this stage as it is causing a lot of frustration and impacting SEO performance.

(Edit): As for reducing unused JS, in chrome dev tools > Coverage, FB Connect and Google Adsense have huge amounts of unused JS code:

Also PageSpeed Insights is showing similar results:

So goal would be to completely defer the loading of FB connect / twitter / Adsense JS code until page has loaded completely. https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript#how_do_you_load_third-party_script_efficiently

已采纳解答

原帖链接 · Mike Ciffone · CC BY-SA 4.0

You've got a lot going on here that is contributing to your problems. At face value, it seems like you're spending an excessive amount of time on script evaluation.

This div is responsible for your layout shifting:

<div class="cell small-12 medium-8 large-9 small-order-2 medium-order-1 large-order-1 panel-content">


Ultimately, there is way too much going on to say definitively. I would start by the following:

  • Get rid of any render blocking assets - you've got 4-5 and I think they're all CSS.
  • Take advantage of resource hints such as preconnect or dns-prefetch to establish early connections to important third-party origins.
  • Figure out how to spend less time evaluating scripts, that's where the browser's main thread is spending a majority of its time.
  • Follow the optimization advice provided by PageSpeedInsights and make sure to do all of them.

I wrote an answer to a similar question you might find useful about determining the cause of CLS.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2021-12-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。