Skip to content Skip to sidebar Skip to footer

How to Install Lazy Load Adsense Easily

How to Install Lazy Load Adsense Easily

How to Install Lazy Load Adsense - Lazy Load Adsense is very useful for those of you who want to install adsense ads and don't trigger blog speed. The way Lazy Load Adsense works is very simple, if we scroll on the blog page, the ad will appear right on the scrolled blog page.

In addition to speeding up loading blogs because of Adsense ads, this Lazy load script can also prevent your adsense ads from being invalid, such as visitor bots, jingling and so on.

For the tutorial, please see below...

How to Install Lazy Load Adsense 

Actually, here I will provide two methods for installing lazy load, namely installing lazy load work on all devices / devices, and lazy load only working on mobile.

#1. Install Lazy Load Adsense Work on All Devices

To install lazy load adsense work on all devices, please follow this tutorial.

1. You first go to blogger.com, and go to the Themes menu, and click Edit HTML

2. After that you look for the code &lt;!--</body>--&gt;&lt;/body&gt; or  </body>

3. Put this code above the code.

<script type='text/javascript'>
//<![CDATA[
// Lazy Load AdSense
var lazyadsense=!1;window.addEventListener("scroll",function(){(0!=document.documentElement.scrollTop&&!1===lazyadsense||0!=document.body.scrollTop&&!1===lazyadsense)&&(!function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyadsense=!0)},!0);
//]]>
</script>

Or you can also use this script

<script>
//<![CDATA[
var lazyadsense = false;
window.addEventListener("scroll", function(){
if ((document.documentElement.scrollTop != 0 && lazyadsense === false) || (document.body.scrollTop != 0 && lazyadsense === false)) {
(function() { var ad = document.createElement('script'); ad.type = 'text/javascript'; ad.async = true; ad.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'; var sc = document.getElementsByTagName('script')[0]; sc.parentNode.insertBefore(ad, sc); })();
    lazyadsense = true;
  }
}, true)
//]]>
</script>
After that, you click Save Theme.

#2. How to Install Lazy Load Adsense Work On Mobile Only

For how to install lazy load adsense only works on cellphone devices, please follow this tutorial.

1. Go to Edit HTML, and look for the code &lt;!--</body>--&gt;&lt;/body&gt; or  </body>

2. Then, you put the code below right above the code earlier:
<b:if cond='data:blog.isMobileRequest == &quot;true&quot;'>
<script async="async" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<b:else/>
<script type='text/javascript'>
//<![CDATA[
// Lazy Load AdSense
var lazyadsense=!1;window.addEventListener("scroll",function(){(0!=document.documentElement.scrollTop&&!1===lazyadsense||0!=document.body.scrollTop&&!1===lazyadsense)&&(!function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyadsense=!0)},!0);
//]]>
</script>
</b:if>
Or it could be this code.
<b:if cond='data:blog.isMobileRequest == &quot;false&quot;'>
<script>
//<![CDATA[
var lazyadsense = false;
window.addEventListener("scroll", function(){
if ((document.documentElement.scrollTop != 0 && lazyadsense === false) || (document.body.scrollTop != 0 && lazyadsense === false)) {
(function() { var ad = document.createElement('script'); ad.type = 'text/javascript'; ad.async = true; ad.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'; var sc = document.getElementsByTagName('script')[0]; sc.parentNode.insertBefore(ad, sc); })();
    lazyadsense = true;
  }
}, true)
//]]>
</script>
<b:else/>
<script async="async" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</b:if>
And don't forget to delete the code below in each ad code.
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
After that, you click save theme.

Well, that was about  How to Easily Install Lazy Load Adsense , hopefully it's useful, don't forget to share the article to make it even more useful.
Farhan.
Farhan. Beginner Writer.