Forum Moderators: martinibuster

Message Too Old, No Replies

Adsense and CLS

is there a fix to adsense ads causing bad CLS

         

surnames

12:25 am on Jan 30, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



I run 2 adsense responsive ads per page. According to Google my CLS (Cumulative Layout Shift) is unnaccaptable at 0.14 on pages served to desktop (mobile OK, for now)

this could cause a downgrade in Google rankings for search engine results.

If I remove the 2 adsense ads I get 97% performance and a CLS of 0.

So to fix the problem that only Google alerts me to (Bing is just fine with my pages) is to remove Google's ads.

There has to be a fix to this. Has anyone solved this problem?

NickMNS

2:20 am on Jan 30, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Has anyone solved this problem?

I wouldn't characterize this as a problem, it is simply part of designing a functional webpage. The root cause of the CLS really depends on your page layout, but typically it is the result of the of elements being added to the page after the initial render. Those element push content down due to the vertically expanding div (or other element). It can also be caused by horizontal shifts of content that then pushes elements wrap to a new line, but the case is less common.

In the vertical case the solution is to fix the height of the ads parent div. If you typically expect ads to 300px high, then set the height to 300px directly in the CSS such that when the page renders without an ad the div is already set 300px. If the ad ends up being 250px this will result in some white space beneath the ad. You cold always center the ad vertically by using flex.

Note that Google page speed insight is great for identifying CLS and pointing you to the tags/styles that need to be adjusted.

Bing is just fine with my pages

CLS results in a really crappy user experience ads or not. How annoying is it when you click a link but the layout shifts and instead you click a link you didn't intend to? Bing may not complain, but your user surely do, and Google knows this and that is why they make a big deal out of it.

surnames

3:21 am on Jan 30, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



thank you NickMNS,
Combined with your reply and some css code someone posted to webmaster world 6 months ago, I might have the PROBLEM SOLVED!
trying it out let you know how it goes, gotta test it on mobiles different screen sizes first

surnames

3:45 am on Jan 30, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



thanks again Nick MNS,
you have helped solve this, been stressing over it for 2 months. Only need to set the vertical height for the one ad at top of page (didn't set sidebar ad) and the CLS dropped from .14 to .007

NickMNS

4:10 am on Jan 30, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm glad to hear that it is solved!

surnames

4:58 am on Jan 30, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



thanks to your additional tip via sticky mail, the CLS went from .007 to 0

can't get better than that

surnames

1:03 am on Feb 6, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



Not Solved, according to Google Core Web Vitals.
After a week they still highlight all my pages served to a desktop as unacceptable with CLS remaining at .14

Testing my pages using

GTMetrix (5mbps broadband) CLS = 0 for desktop
and PageSpeedInsights (recommended by Google) CLS=0 for desktop

Google reports daily on CLS in Core Web Vitals and as of Friday 4th Feb they say the CLS is still 0.14

any input gratefully received

robzilla

11:16 am on Feb 6, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Maybe run it through these online tools:

[defaced.dev...]
[webvitals.dev...]

See what comes up.

surnames

1:10 pm on Feb 6, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



thanks for the urls, Robzilla

webvitals,dev didn't deliver a result after 15 mins

I got a CLS of .025 with defaced.dev, can see I need to reduce allowing size for ads a bit

So I still don't know where Google gets their CLS of 0.14 from, unless they are averaging a figure over 28 days as [pagespeed.web.dev...] does

robzilla

3:01 pm on Feb 6, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



unless they are averaging a figure over 28 days

Could be, I don't know how often these are updated, or what time period they represent. Maybe give it a couple of weeks to see if anything changes.

Wouldn't worry about it anyway, it's not likely to hurt your rankings. But it's an itch I would probably also want to scratch ;-)

eriky

7:27 pm on Feb 6, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



An additional tip is to set the min-height of the surrounding element instead of the height. You can even adapt the AdSense code itself to include this min-height style. If you set it to 250px or so, the CLS will be a lot less. But honestly, I don't think it's a big problem. Google would be foolish to punish sites running their own ads.

Dimitri

10:05 pm on Feb 6, 2022 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



Google would be foolish to punish sites running their own ads.

Repeat after me, Google Search, and Google Adsense, are two different entities, with different goals, and different visions.

robzilla

10:26 pm on Feb 6, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Google Search, and Google Adsense, are two different entities, with different goals, and different visions.

Sgt_Kickaxe

11:45 am on Feb 8, 2022 (gmt 0)



Google Search, and Google Adsense, are two different entities, with different goals, and different visions.

- This is still true but it has weakened a good deal of late

Both Google search and Google adsense are clearly saying "entertain the traffic" right now. Pure information has become boring to both, they want more. If you've tried getting a new informational site approved for adsense recently you'll probably find that pure information is marked "low value". Add a unique, followable personality that shows signs of a growing audience to that same information and suddenly it's no longer "low value", even if the information never changed.

Another telling sign is that if you generate traffic from a source other than google search it's almost too simple to be approved for adsense and search rankings get the featured snippet at a high rate despite not ranking well.. There is definitely some synergy between adsense and search interests developing.

Google wants to show what's popular and they want to monetize it too. Ugly ducklings are shunned by both. Resonate with real visitors or perish.

eriky

11:56 am on Feb 8, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



Sound like some wise words. But even without the explanation, I strongly believe that Google does have all kinds of workgroups and initiatives to better monetize their products by letting them work together, or at least not work against each other. They would be foolish not to, and we all know they hire some of the brightest minds in the industry.

surnames

12:04 pm on Feb 22, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



UPDATE

re: fixing my site (on 31 Jan) so CLS is well under Google's limit of 0.1 (closer to 0) and still:

"Google reports daily on CLS in Core Web Vitals and as of Friday 4th Feb they say the CLS is still 0.14"

As of 3 days ago Google has given the OK on all pages served to desktop with CLS at 0, so it just took a few weeks for them to crawl the pages.

robzilla

12:15 pm on Feb 22, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



so it just took a few weeks for them to crawl the pages.

No, it's a common misconception but Google doesn't crawl pages to determine the Core Web Vitals. There is probably some delay in the report from the Chrome UX Report, or it's averaged over a period of time, or something like that. If you really want to know, you could query the report yourself.

Either way, you wouldn't notice a difference in ranking between getting a passing or a failing grade. Glad it was fixed anyhow.

Sgt_Kickaxe

4:21 am on Aug 27, 2022 (gmt 0)



Search console has updated the wording around CLS.

- The first thing you need to know is that they group your pages into 3 groups. Good(green), needs work(yellow) and bad(red).
- The second thing you need to know is that when you fix a CLS issue you need to "validate" the fix in search console and expect to wait up to 28 days.

During that 28 days(or less) they collect data from real visitors to your site and come up with a new average CLS score per group of pages. Search console doesn't care of the source of a CLS, be it adsense or anything else. That being said if you just use auto-ads code and let Adsense decide what goes where 100% you're going to get CLS, especially on mobile browsers.

The fix described pretty much everywhere is to add a min-height attribute to a div container but this leaves a big empty space if no ad is served or if a small ad is served.

A real fix would be for adsense to stop serving ad code of 0px in height and adjusting it after an ad is selected. Until adsense is made faster I don't think that's going to change. An empty space with a min-height still provides a bad user experience if ads just appear long after the page has loaded, imo.