Script Lazy Load AdSense to increase the speed of opening blogger site

Script Lazy Load AdSense For Blogger

The speed of your website is extremely important, as it is the primary factor that gives the first impression to visitors about the quality of your site, and it plays an important role in improving your ranking on the Google search engine by measuring the visitor’s interaction and the length of his stay on the site, and thus the content with a reasonable reading time is ranked in the first ranks. As useful content for researchers to interact with.

Therefore, you must make sure to speed up your website and increase the speed of opening the site by adding a script that delays the appearance of AdSense ads and make sure that the textual content appears first. For this reason, we will explain the method of delaying the loading of AdSense ads for Blogger blogs by installing a small JavaScript code that will not affect the speed, but on the contrary, it will increase the speed. your site greatly.

The plugin that we will explain in this lesson is a script that is installed inside the HTML code of the template and works to speed up the blog opening time by delaying the appearance of ads and displaying the content first.

The way to install the LazyLoad Adsense script is very simple. You must place the JavaScript code under the /body tag in the theme > Edit HTML inside your template codes, or by placing it directly at the top of the page under the /head tag. You must modify the publisher ID code “ca-pub-000000000000” and replace it with the code. your.

How does the lazy load AdSense script work?

The AdSense lazyload ads script delays the loading of ads until the visitor scrolls the page (pulling the screen down), which greatly helps in displaying the rest of the site’s contents first in order to draw the visitor’s attention and keep him while the ads load late.

  1. When a visitor enters your site, the connection is connected to the AdSense advertising provider’s server in order for the ads to be displayed
    pagead2.googlesyndication.com
  2. The function of the script is to cut off the connection between the browser and the AdSense advertising network provider until the visitor scrolls the page. This is called a lazy loading code for ads.

Naturally, there are many scripts and add-ons that perform the same task, which is to delay the appearance of ads on the site, but many of them are not compatible or do not work on all Blogger templates , so we were keen to provide the best code to delay the appearance of ads that works on all templates, while explaining how to install and run them.

Benefits of installing a code Lazy Load Adsense on the site

When you install the code to delay the appearance of ads on the blog, the speed of opening the site will increase significantly , and you can verify the effectiveness of adding the delay in the appearance of ads by examining the speed of your site through the Speed Insight tool from Google before and after installing the add-on, and notice the big difference in your site’s speed scores.

The code to delay the appearance of AdSense ads will improve the bounce rate on your site, increase the average reading time significantly, give a lot of positive impressions in the hearts of visitors, and encourage them to browse more content and stay on the page for as long as possible.

It will also solve the problem of slow blogging, which is often due to the large number of scripts in templates built with a poor coding system. You must get rid of all these problems and improve the performance of your site by installing a script that delays loading ads on the page.

How to install script LazyLoad AdSense on your blog

We have now reached the stage of installing the code to delay loading ads on the blog. We will explain the steps that you must take in order for the code to work on your site without problems.

Copy this code to your clipboard:

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

Now go to your blog and go to Appearance » Edit HTML and search for the following tag. /body If you do not find it, it is present on all templates at the end of the page. Last thing.

Now paste the code to delay the appearance of AdSense ads that you copied and place it directly above the /body tag, that is before it, and press Save.

After that, search within the template codes for the beginning of the template body. <body You will find it only once, and place this code below it (directly below it).

HTML
<b:section class='lazyads' id='lazyads' name='Lazy Adsense' showaddelement='false'>
      <b:widget id='LinkList151' locked='true' title='LazyLoad AdSense' type='LinkList' version='2' visible='true'>
        <b:widget-settings>
          <b:widget-setting name='sorting'>NONE</b:widget-setting>
          <b:widget-setting name='text-0'>googleAds</b:widget-setting>
          <b:widget-setting name='link-0'>ca-pub-xxxxxxxxxxxxxxxx</b:widget-setting>
        </b:widget-settings>
        <b:includable id='main'>
				<b:include name='content'/>
			</b:includable>
        <b:includable id='content'>
			&lt;script defer=&#39;defer&#39; type=&#39;text/javascript&#39;&gt;
			//&lt;![CDATA[
				<b:loop values='data:links' var='link'>
<b:if cond='data:link.name == &quot;googleAds&quot;'>
var googleAds= &quot;<data:link.target/>&quot;;
function _0x4c95(){var _0x2e33d7=[&#39;src&#39;,&#39;1303626IfYuXA&#39;,&#39;411228XTNWpo&#39;,&#39;async&#39;,&#39;script&#39;,&#39;20047QujCnW&#39;,&#39;631534MCLEVv&#39;,&#39;createElement&#39;,&#39;35CmMbYD&#39;,&#39;3QVbhMD&#39;,&#39;insertBefore&#39;,&#39;scrollTop&#39;,&#39;15102441vBIzfO&#39;,&#39;2670895IpPfrr&#39;,&#39;scroll&#39;,&#39;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-&#39;,&#39;documentElement&#39;,&#39;text/javascript&#39;,&#39;type&#39;,&#39;10785296ZPJdCz&#39;,&#39;parentNode&#39;];_0x4c95=function(){return _0x2e33d7;};return _0x4c95();}var _0x42cac1=_0x5062;(function(_0x50639d,_0x5c826b){var _0x15038c=_0x5062,_0x9eef47=_0x50639d();while(!![]){try{var _0x4252da=-parseInt(_0x15038c(0x149))/0x1+parseInt(_0x15038c(0x14a))/0x2*(-parseInt(_0x15038c(0x14d))/0x3)+-parseInt(_0x15038c(0x15b))/0x4+parseInt(_0x15038c(0x151))/0x5+parseInt(_0x15038c(0x15a))/0x6*(parseInt(_0x15038c(0x14c))/0x7)+parseInt(_0x15038c(0x157))/0x8+-parseInt(_0x15038c(0x150))/0x9;if(_0x4252da===_0x5c826b)break;else _0x9eef47[&#39;push&#39;](_0x9eef47[&#39;shift&#39;]());}catch(_0x20cee1){_0x9eef47[&#39;push&#39;](_0x9eef47[&#39;shift&#39;]());}}}(_0x4c95,0xd003a));var ads=!0x1;function _0x5062(_0x564bd4,_0x1ed14a){var _0x4c953e=_0x4c95();return _0x5062=function(_0x506205,_0x538861){_0x506205=_0x506205-0x149;var _0x3fea82=_0x4c953e[_0x506205];return _0x3fea82;},_0x5062(_0x564bd4,_0x1ed14a);}window[&#39;addEventListener&#39;](_0x42cac1(0x152),function(){var _0x2471d3=_0x42cac1;(0x0!=document[_0x2471d3(0x154)][_0x2471d3(0x14f)]&amp;&amp;!0x1===ads||0x0!=document[&#39;body&#39;][&#39;scrollTop&#39;]&amp;&amp;!0x1===ads)&amp;&amp;(!(function(){var _0xb02e57=_0x2471d3,_0x46e6b0=document[_0xb02e57(0x14b)](_0xb02e57(0x15d));_0x46e6b0[_0xb02e57(0x156)]=_0xb02e57(0x155),_0x46e6b0[_0xb02e57(0x15c)]=!0x0,_0x46e6b0[_0xb02e57(0x159)]=_0xb02e57(0x153)+googleAds+&#39;&#39;;var _0x3169e7=document[&#39;getElementsByTagName&#39;](_0xb02e57(0x15d))[0x0];_0x3169e7[_0xb02e57(0x158)][_0xb02e57(0x14e)](_0x46e6b0,_0x3169e7);}()),ads=!0x0);},!0x0);
                  </b:if> 
				</b:loop>
			  //]]&gt;
			  &lt;/script&gt;
			</b:includable>
      </b:widget>
      </b:section>

Change the ID that we marked in green in the code “xxxxxxxxxxxxxx” and replace it with the publisher ID of your AdSense account

Note: The beautiful thing about this script, which we present to you exclusively for the first time, is that it supports the ability to modify the AdSense ID through “formatting” within the blog’s control panel, and there is no need to deal with codes every time you want to replace the ID.

The next step is to remove your AdSense account ID from all ad codes, delete anything before (above) a hashtag <ins and leave it only for the lazy load script to work properly for you.

The text tag appears like this, remove it wherever it is:

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

You will find it before any advertising code on your site (with the ID). Delete it from all places if it exists, otherwise the adsense lazyload script will not work.

I am pleased to tell you that this is all that matters, and the Lazy Load Adsense add-on is now ready on your site. Ads will not be displayed and will be prevented from appearing until the visitor scrolls down. If you encounter any problem during installation, do not hesitate to ask us for help through the comments.

Attention: The ownership of creating this script is reserved by the modows.com website. If you want to republish it on your site please mention the source, Good luck.

Next Post Previous Post
No Comment
Add Comment
comment url