Site logo

Archived topic

Using Google Ads in Generatepress with least possible effect on CoreWebVitals

10 replies · Started by Shrawan on May 25, 2021

Viewing posts 1–11 of 11

Hello team,

I have a question about what is the best possible way to use Google Ads in Generatepress (Marketer theme) keeping in mind the Core Web Vitals? I notice that my score drops into the red zone when I include Google Ads, especially when I use auto ads, and I do understand this has nothing to do with my server or the theme as these are external resources.

I'd like to understand what is the best way to use it so that we can control the damage to a large possible extent - do you have a plugin recommendation or a proven technique/best practice. For instance, I see CLS changes drastically if I use auto ads.

Looking for your guidance.

Hi Shrawan,

Aside from plugin optimizations to improve quickly to serve/load the script involved with the ads (WP rocket, autoptimize, litespeed cache, etc), you can try Google's very own recommendations found in their documentation.

Here's an example -
https://developers.google.com/publisher-tag/guides/minimize-layout-shift#how_to_reserve_space

The principle for this one is simply to pre-assign the height for the ad's wrapper element so there's no "pushing" that happens when the actual ad loads.

You can read throughout the page for the other tips on what best to do for your ads to avoid CLS.

I'm using the Flying Scripts plugin to defer loading the Adsense script for a few seconds. Pagespeed: better than 95/95. :-)

Thanks for sharing @Bas! :D

@Shrawan, you can try this recommendation. Or you can try other plugins of similar functionality. :)

Hi @Bas - are you able to manage 95/100 in Mobile & Desktop scores?

Secondly are you using a cache plugin in your installation, I ask because of compatibility issues (I use Breeze or WP Rocket)

Hi, @Shrawan, at the moment, the pagespeed is even 100/100 (and it's not a nearly empty website!). :-)) But sometimes the pagespeed is a bit lower, around 90/97.

Very recently, I switched to another cookie consent manager. I'm using the Moove GDPR plugin now, which works excellent for me. That plugin loads the GoogleAds.js and Analytics code only after consent, so that keeps a nice Google Pagespeed. ;-) I'm also using the WP Optimize plugin for minifying and cache, which I also use to defer polyfill.min.js, and I'm using the free tier of the Cloudfare CDN.
Besides that, I've made quite some adaptations to image sizes etc, and I'm using Webp images.

Example: https://www.eetzaken.nl

I've still got some issues with the site vitality, which should be solved by now but Google likes to wait for 28 days...

Hi @Bas wonderful insight. Just wish to understand if you are using Auto Ads. Or have you placed the code manually. Thanks.

Yes, I'm using Auto Ads. Manual placement is a bit difficult when you only can show ads after consent (wouldn't know how to solve that...)

Hi @Bas I've managed a 100/100 score, but once I enable ads it crashes to under 40 for mobile. I'll use your recommendations, thank you again for this guidance :-)

You're welcome!

You might get some Site Vitality or CLS-issues when Adsense wants to put an add between the logo and navigation bar. You can delete that position (in mobile only!) in the Adsense admin.

Thanks Bas for helping out!

This archived topic is closed to new replies.