How To Add LazyLoad Google Adsense in Blogger

Hello Everyone, on this occasion I will share How to Add LazyLoad Google Adsense in Blogger. Adsense is certainly no stranger to all bloggers. Adsense is an alternative way for a publisher to earn money on a blog. On the other hand adsanse js also affects the loading of the blog, which reduces the loading speed of the blog a bit.

For those of you who have just got Adsense. Have implemented the script provided by Adsense on my blog. You will definitely see that the speed of your blog is less than before.

So I will suggest in this post how to set up the right ad unit and use Lazy Load Adsense to speed up blog loading.

What is Lazyload Adsense ?

Lazy load is a technique to delay the Adsense JS on the Adsense website to be asynchronous, which means that once the top content is fully loaded, Adsense JS will not load.

Lazy Load Adsense is useful to speed up blog loading by temporarily delaying the loading of Adsense JS. And moreover when the page is scrolled by the user the adsense js will be loaded.

How To Add LazyLoad Google Adsense in Blogger :-

Step 1 :-First of All Go To Blogger.Com And Login Your Blogger Account.
Step 2 :- Then Click on Theme Menu.
Step 3 :- Then Click on Edit Html.
Step 4 :- Then find </body> and then paste the lazy loaded Google adnsense code given.
var lazyadsense2 = false;
window.addEventListener("scroll", function(){
if ((document.documentElement.scrollTop != 0 && lazyadsense2 === false) || (document.body.scrollTop != 0 && lazyadsense2 === false)) {
(function() { var ad = document.createElement('script'); ad.setAttribute('data-ad-client','ca-pub-123456789xxxxxxx'); ad.async = true; ad.src = ''; var sc = document.getElementsByTagName('script')[0]; sc.parentNode.insertBefore(ad, sc); })();
lazyadsense2 = true;
}, true);

Note :- Change Your Ca Pub Id.

Step 5 :- Then Don’t Forget to Click on Save Theme.

Note :- If your template still includes this script, remove this script. <script async=”” src= “”><script>

Recommended Adsense Ad Unit Writing :-

One of the reasons for slow blog loading is the frequent writing of Adsense scripts (adsbygoogle.js). So every time you add an ad unit you don’t need to rewrite adsense script, write correct ad unit like below example

<ins class="adsbygoogle"
     (adsbygoogle = window.adsbygoogle || []).push({});

Not Recommended Adsense Ad Unit Writing :-

<script async src=""></script>
<!-- link -->
<ins class="adsbygoogle"
     (adsbygoogle = window.adsbygoogle || []).push({});

Conclusion :-

In this post I have told you about all How To Add LazyLoad Google Adsense in Blogger. So how did you like this post, you can tell by commenting.




Leave a Reply

Your email address will not be published. Required fields are marked *