How to solve the LCP Issue/ problem on core web vitals due to google adsense ads?

 

Performance blogs or websites will eventually drop when advertised by third parties such as ads on Google Adsense and other digital advertising. To avoid that, a special method is needed to load ads so that loading or website performance is maintained.


Generally the method used to load ads so as not to affect the performance of the website/blog is to apply lazy load to fish (adsense), therefore here I will give a fairly complete review of lazy load adsense.


You can solved the LCP Issue/ problem on core web vitals due to google adsense ads with Lazy Load Adsense.


Without Lazy Load Adsense your LCP can be poor or higher than 4s. The best LCP is lower than 2,5 s.



What is Lazy Load Adsense?

lcp issue adsense 1

Lazy load adsense is a lazy loading or smart loading script on adsense ads to reduce the impact of third party code on the website and maintain optimal website performance.




There are several methods for making smart loading on adsense ads including Ad event listeners, Event-based ad requests and Lazy loading, all three of which can be referred to as lazy load adsense.



Why Should You Use Lazy Load Adsense?


Currently there is no better method than lazy load adsense to solve all kinds of website performance issues caused by third party ads.

There are many things that can be solved with lazy load adsense, related to website/blog performance problems, including:
  • Third party webfont load
  • JavaScript execution time
  • Main-thread work
  • Impact of third party code, etc
That's why in my title tag it says, lazy load adsense is the best solution for the performance of websites or blogs that are installed with third-party ads.

Immediately I will share the lazy load adsense script with all of you, there are 3 (three) lazy load adsense scripts that I will share and both lazy load scripts are equally good for maintaining the performance of your website and also support auto ads.



Instructions for Using Lazy Load Adsense


How to use the lazy load adsense script is very easy, you only need to install one of the lazy load adsense script codes in the head or body of the website, then remove all adsense javascript library tags from the website/blog template.

Change your adsense script :


<script async="async" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"/>

//or a new version of the javascript library
<script async="async" data-ad-client="ca-pub-1234567890123456" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"/>

//or updated version
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4209467777280582" crossorigin="anonymous"></script>


To :


<script type="text/javascript">//<![CDATA[
var lazyloadads=false;window.addEventListener("scroll",function(){(0!=document.documentElement.scrollTop&&false===lazyloadads||0!=document.body.scrollTop&&false===lazyloadads)&&(!function(){var e=document.createElement("script");e.type="text/javascript",e.async=true,e.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-420946777728xxxx";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyloadads=true)},true);
//]]></script>

Change the red text with your adsense publisher code



How the Lazy Load Adsense Script Works ?


Lazy Load Adsense is completely different from lazy load images because basically lazy load adsense is a scroll event listener, the adsense javascript library in the lazy load adsense script will only be loaded or run when the user scrolls your page.

And that means that adsense ads will only appear when the user scrolls through your blog or website, if there is no page scrolling activity from the user, the ad will also not be loaded (not displayed).
lcp issue adsense 2



Lazy Load Adsense From Adsense Policy Side


Google is very open to implementing lazy loading on their ads (adsense), Please see the google help center entitled "Viewability best practices". On that page, Google recommends the use of lazy load adsense or also known as smart loading.





For detail step by step yo can watch this video below.


 



That means Google doesn't care about the use of lazy laod adsense. But according to google the best practice for implementing lazy load adsense is to use the Google Publisher Tag (GPT).



Reference


https://www.cordialblogger.com/2021/04/lazy-load-adsense.html
https://nanokaryamandiri.com/

Featured Post

How to fix CLS issue in your blog or web ?

  Fixing CLS issues is a big deal. That's because most of your competitors won't fix CLS problems and as a result won't rank wel...