Speed up Loading Blog with AdSense Lazy Load

Speed up Loading Blog with AdSense Lazy Load

Updated on 14 May
On the other hand AdSense is one of the contributors to loading because the ads displayed JS AdSense will reduce the loading speed of our blog even though JS AdSense already uses asynchronous, but still it will still make the blog wait longer to load.

Well, for friends who want to speed up loading their blog, please follow the following tips.

Speed up Loading Blog with AdSense Lazy Load

The way the code works is quite simple, that is, the ad will appear after we scroll the page. So AdSense JS will not appear before we scroll the site page.
These tips are intended for friends who have installed AdSense on their blog. For those who haven't, the code that I will share can be used for other needs such as loading an external JS link.
Go to Blogger > Themes > Edit HTML > Add the code below before </body> or &lt;!--</body>--&gt;&lt;/body&gt;.

<script>
//<![CDATA[
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>
If not, make sure to delete all AdSense JS links that are usually installed in the AdSense ad unit code. Like this:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
After adding click the Save theme button and finish.

Maybe you ask.

Is this code safe for our AdSense?
The answer is of course safe. Because Google also suggested to speed up loading the blog as well as installing the Lazy Load Image code to speed up image loading on the site's pages.

And will it affect the revenue of our AdSense blog?
I don't know for this one, because I just installed it myself. We just see the progress, if income is reduced maybe it is indeed not our sustenance. Uh, the solution is you can revoke the code and restore it as before.

In conclusion, prioritize what you think your friend needs. If you want to blog faster, you can do the above trick, but if you are still unsure of AdSense revenue (which might be), you can drop your intention to install it. But for me this is what I consider to be a new experience, what I value here is the progress "Will installing this code affect AdSense?" Well, that curiosity makes me more excited even though there are risks that need to be accepted.
source: blog.krakentechno.com

0 comments for Speed up Loading Blog with AdSense Lazy Load

Cancel