How to Lazy Load Google AdSense in Blogger [2022-23]

Google AdSense Lazy Load to improve Website loading speed, Steps to lazy Load Google AdSense in Blogger

If you are using Google AdSense as a revenue source in your blogger website, then you need to optimise them to improve Website loading speed. After 2021 website speed also a Ranking Factor.

Why Google AdSense Lazy Load?

Google AdSense Lazy Load

By default Google provide to publishers a asynchronous adsense library to load ads. If you are using this by default ads script codes in show ads in your website, then this will reduce your page speed upto 30%.

But now! Say Hi to Lazy Load. Who allow publishers to load their adsense code after user scroll. There are many types of ways in the internet to load this script lazy to improve performance. Some techniques are Async, Defer, Lazy, Onscroll, Onload, Onclick etc.

Many wordpress users using the onclick technique to load their scripts. But in blogger this technique is not working in all themes. So you need to use Onscroll technique to lazy load AdSense in Blogger.

Before changing any codes in your template try to Backup of your current theme. If you done any wrong steps then you can easily restore your theme without any hassle

Google AdSense Lazy Load
After using AdSense Lazy Load (Not applicable for every template)

Steps to Lazy Load Google AdSense

  1. Go to blogger Template section >> Edit HTML >> and find old adsense script.
  2. Remove the old script looks like code below.
  3. After removing all old script paste my new script above </body> or  &gt;&lt;/body&gt; .
  4. Replace the highlighted codes with you Pub id and save the template.

You need to remove this code below from all your website.

<script async='async' src=""    crossorigin="anonymous"></script>

After removing that code, copy new code below and paste it above </body> as i mentioned in step 3.

<script>/*<![CDATA[*/ var lazyadsensefast = false; window.addEventListener('scroll', function(){if ((document.documentElement.scrollTop != 0 && lazyadsensefast === false) || (document.body.scrollTop != 0 && lazyadsensefast === false)) { (function() { var ad = document.createElement('script'); ad.setAttribute('crossorigin','anonymous'); ad.async = true; ad.src = ''; var sc = document.getElementsByTagName('script')[0]; sc.parentNode.insertBefore(ad, sc); })(); lazyadsensefast = true; }}, true); /*]]>*/</script>

After removing check your page speed in Google Speed testing tool. If you want to get a fast loading blogger template then i want to recommend Plus UI Premium Blogger Template, a Core web vitals friendly blogger theme

Getting Info...
Hi there! I am a part time blogger from India and i like to coding in free times.

Buy me a Coffee

Post a Comment

Share your thoughts here! Communicate with other readers. Your comments will visible after getting approved by the editors.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage and improve this website, we request you to whitelist our website in your adblocking plugin/browser.