How to install Lazy Load Google Adsense to speed up website loading

How to install Lazy Load Google Adsense to speed up website loading

You feel annoyed because adsense ads make your website have low loading speed. Installing Lazy Load Google Adsense will help speed up website loading.

When accessing any website, it will be annoying to have to wait for it to load forever. Was it a waste of time? So, as the owner of a blog, you probably don't want your users to encounter such a situation.

There are many factors that affect page load and one of them is caused by google adsense ads. In this article, I will share with you how to install Lazy Load Google Adsense to speed up website loading.

Install Lazy Load Google Adsense

Lazy loading helps to optimize google adsense javascript codes, making your website look smoother even though it contains those ad codes. Let's complete the installation of lazy loading google adsense through 5 easy steps.

Step 1: Visit your blog dashboard.

Step 2: Go to Theme then select Edit HTML

Step 3: Find code <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>, then delete it. If more than 1 is found, delete all you found. Each code corresponds to an ad that you have placed.

Step 4: Next find the </body> code and put the entire code below right before it.

<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>{codeBox}

Step 5: Save your template, enjoy the difference by visiting the link: https://developers.google.com/speed/pagespeed/insights, enter your homepage url to check the page loading speed.

Conclusion

So, I have shared with you how to install lazy loading google adsense.

It's easy, isn't it? From now on, your visitors will be more comfortable visiting your blog. They won't have to wait too long to read the content. Best of all, this lazy loading code won't affect your earnings much.

I wish you success, don't forget to continue to support me in the next posts. Thank you.

Source: www.bloggerkoplo.com

Post a Comment (0)
Previous Post Next Post