Saturday, December 1, 2018

Increase Blog Speed Using Lazy Load for AdSense

    How to Setup Lazy Load for AdSense to Increase Blogger Speed in Google PageSpeed Insight

    Webpage Speed is an Google Ranking Factor

    AMP Blogger - The speed of a website page is one of the factors that determine ranking on Google. This is valid and has been mentioned in many forums held by Google.

    Google is more concerned with the convenience of internet users than features in a website, and makes the most relevant content that will become the first page on SERP.


    To optimize website pages, Google has built a tool that can be used free of charge by Webmasters to maximize the rendering speed of websites. This tool is called Google PageSpeed Insight. 

    If you audit a website on Google PSI, you will get results that Google AdSense turned out to be blocking-rendering. That is, the Google AdSense ad script makes your website slow when rendered.

    It is certainly detrimental to you and your visitors. But of course there is a solution to the problem.

    This time I will share a solution to speed up loading a website by using Google AdSense Lazy Load. This can maximize the rendering speed of a page that has a large number of ads.

    Increase Speed Using Lazy Load for AdSense

    I dedicate this tutorial to websites that use Blogger, if you use another CMS, you just need to improvise it. 

    First step, you should to remove all this AdSense syndicate script.

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

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

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

    Note: search one by one the above code, then delete.

    Then copy and paste this script, right before </body>  or  &lt;/body&gt;--&gt; </body>

    <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="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyadsense=!0)},!0);
    //]]>
    </script>

    The script will render AdSense Ad if all the content has been rendered. So that it will speed up the speed of your blog, and maximize the score on Google PSI.


    Good luck :)