How to Lazy Load Adsense Ads in Blogger
Updated on 16 May
Making your website fast is a technique to increase your website traffic and also increase your rankings on Google.
You should have heard about lazy loading images but today I am going to tell you how you can lazy load AdSense ads to make your website load faster.
Without this script when your website loads it takes too long because it has to fetch data from Google AdSense but after this your website will load faster and AdSense ads will be loaded on event and that event is scroll.
Steps To Follow:
- Go to Blogger.com
- Go to Theme Section
- Click on Edit HTML
- Now copy the code provided below.
- Search for </body>
- Paste code above this tag.
- Now search for </head> and paste the code below above this tag.
- Save Theme
// LazyLoad AdS
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);
Pess CTRL+F and paste your search term and hit enter.
<!--Adsense Integration-->
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "Your-Client-ID-Here",
enable_page_level_ads: true
});
</script>
<!--/AdSense Integration-->
Replace Your-Client-ID-Here with your client id like ca-pub-1928361826382617.
Now where you want to put your AdSense ads you have to add AdSense AD Code don't use AdSense AD widget because if you add AdSense AD widget in blogger then this script will not work because adsbygoogle.js script will be automatically loaded.
This was simple tutorial I think this helped you a lot and if it did make sure to subscribe to the newsletters of this blog.
0 comments for How to Lazy Load Adsense Ads in Blogger