How To Add 4 AdSense Ads Slots In Blogger Blog Posts

How To Add 4 AdSense Ads Slots In Blogger Blog Posts

Guys if your website is on blogger.com and you have approval of AdSense. So this is the problem you will have the most. How to add AdSense's ad unit inside the article. Because different types of ads unit can be added to a lot of space in the blog, but it is difficult to add AdSense ads within the article. And many uses start adding the ad code of AdSense in every post and it is quite annoying.

But today I will tell you such a code. Which if you add to the theme of your blog. So all the posts of your website will run 4 types of ads in different positions. The benefit of which will be that users will click more and more on those ads and your income will also increase.

How To Add 4 AdSense Ads Slots In Blogger Blog Posts


  • Login to your blogger blog Dashboard.
  • Then go to Theme >> Click CUSTOMISE
  • Now click Adjust Widths >> select Add CSS
  • Copy the code below and paste it into the box.

/*---advertisement --*/
.advertisement-on .widget,.advertisement-under .widget{width:100%;margin:5px 0;display:inline-block}
#ad-script1,#ad-script2,.advertisement2{margin:10px auto;display:inline-block;width:100%;}
.advertisement1{float:left;margin-bottom:10px;width:100%}
  • Click on Apply to blog.


  • Then go to Theme > > Edit HTML.
  • Click anywhere inside the code area and press Ctrl + F keys to open the search box.
  • Now, Search for <data:post.body/> tag and paste below code just above of this tag.

  • Note :- If you see this code one or more times, Select the code that appears in the last.

    <b:if cond='data:view.isPost'>
    <div class='advertisement1'>
    <!--put the ad code here-->
    </div>
    <div id='ad-script1'>
    <!--put the ad code here-->
    </div>
    <div id='konten'>
    <data:post.body/>
    </div>
    <div id='ad-script2'>
    <div style='clear:both;'>
    <!--put the ad code here-->
    </div>
    </div>
         <script>
         function insertAfter(tbh,tgt) {
           var prt = tgt.parentNode;
           if (prt.lastChild == tgt) {prt.appendChild(tbh);} 
           else {prt.insertBefore(tbh,tgt.nextSibling);}}
           var tgt = document.getElementById(&quot;konten&quot;); 
           var ad1 = document.getElementById(&quot;ad-script1&quot;);
           var ad2 = document.getElementById(&quot;ad-script2&quot;);
           var tg1 = tgt.getElementsByTagName(&quot;p&quot;); 
           var tg2 = tgt.getElementsByTagName(&quot;br&quot;);   
           var pt1 = tg1.length; var pt2 = tg2.length; 
           var ps1 = pt1*34/100; var ps2 = pt1*67/100;
           var br1 = pt2*34/100; var br2 = pt2*67/100;
           var bl1 = Math.round(ps1); var bl2 = Math.round(ps2);
           var bk1 = Math.round(br1); var bk2 = Math.round(br2);
           if (pt1 &gt; 2) {
               insertAfter(ad1,tg1[bl1-1]); insertAfter(ad2,tg1[bl2-1]);
           } else if (br2 &gt; 1) {
               insertAfter(ad1,tg2[bk1-1]); insertAfter(ad2,tg2[bk2-1]);
           } else {}
         </script>
    <div class='advertisement2'>
    <!--put the ad code here-->
    </div>
    </b:if>

  • <!--put the ad code here--> :- Replace with AdSense ads code.
  • Click Save Theme.
  • ViewCloseComments
    Cancel