How to

How to Add Adsense Ads In the Middle or Anywhere inside Blogger Posts

In this Post I Will Show You How to Add Adsense Ads In the Middle or Anywhere inside Blogger Posts. Mostly New Blogger Facing This Problem They Want to Show Adsense Ads in The Middle Of Post etc. Best posts Area, The Most Common Locations are below the title, at the beginning of the post or at the end of it. So let’s Place Adsense Ads In Middle of The Post in Blogger

Place Adsense Ads In Middle of The Post in Blogger
Place Adsense Ads In Middle of The Post in Blogger

Placing Adsense ads in the middle of all the posts will give a high CTR which eventually increases earnings. In word press, There are customized plugins available for placing ads in the middle of the posts. But in the case of the blogger, it is a somewhat tricky part to place Adsense ads in the middle of all the posts. We have developed a script which can place AdSense ads in between the post exactly in the middle of the content. The procedure for placing Adsense ads in the middle of the posts in the blogger is shared below.


Place Adsense Ads Automatically In Middle of All The Posts In Blogger: 

Step 1: the First Thing we need to do is to Parse the AdSense code and convert it to plain text.

Then go to “Template“, click on the “Edit HTML” button and click anywhere inside the code area to search using CTRL + F keys for this:

<data:post.body/>

Note: You will get multiple codes similar to the above code. You have to select the second code which is similar to the above code in order to make the script work properly.

Step 2. Replace <data:post.body/>  with this code:

<div expr:id='”adsmiddle1″ + data:post.id’></div>
<b:if cond=’data:blog.pageType == “item”‘>
<b:if cond=’data:blog.pageType != &quot;static_page&quot;’>
<div style=”clear:both; margin:10px 0″>
<!– Add here the code of your ad –>
</div>
</b:if>
</b:if>
<div expr:id='”adsmiddle2″ + data:post.id’>
<data:post.body/>
</div>
<script type=”text/javascript”>
var obj0=document.getElementById(“adsmiddle1<data:post.id/>”);
var obj1=document.getElementById(“adsmiddle2<data:post.id/>”);
var s=obj1.innerHTML;
var r=s.search(/x3C!– adsense –x3E/igm);
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>

Step 3. Add the converted Adsense code on where you see the <!– Add here the code of your ad –> annotation, then save the changes by clicking on the “Save template” button.

Note: For centering the ads, add the <center></center> tags before and after the AdSense code, like this:

<div style=”clear:both; margin:10px 0″>
<center>
<!– Add here the code of your ad –>
</center>
</div>

Adding the AdSense annotation to display the ad

Step 4. When you create a New Post, add this annotation inside the “HTML” section to where you want the Google AdSense ads to appear:
<!– adsense –>

For example:

On-Page Seo. On-page SEO is the practice of optimizing individual web pages in order to rank higher and earn more relevant traffic in search engines.<br /><br /> <!– AdSense –> On-page refers to both the content and HTML source code of a page that can be optimized, as opposed to off-page SEO which refers to links and other external signals.

AdSense annotation in the middle of the post content
Please note that if you don’t add this annotation to specify where to display the ad, then it will appear below the title by default.

Method 2

Place Adsense Ads Automatically In Middle of All The Posts In Blogger:

Follow The below process to place Adsense ads in Middle of all the posts automatically in blogger.

Step 1:

Login to Your Blogger Account
Go to Template >Edit HTML

Step 2:

Search For Below Code in your template.
<data:post.body/>
You will get multiple codes similar to above code. You have to select the second code which is similar to above code in order to make the script work properly.

Step 3:

Replace The above Code With The Below Code.
<div id='jobmiddlenew'> 
<data:post.body/> </div>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<style> #addcodemiddle{display: none;} </style>
<div id='addcodemiddle'> Place Your Ad Code Here </div>
<script type='text/javascript'> var str1=document.getElementById(&quot;jobmiddlenew&quot;).innerHTML; var str2=str1.length; var str3=str2/2; var substr = str1.substring(str3, str2); var n = substr.search(&quot;&lt;br&gt;&quot;); if(n&lt;0) { n = substr.indexOf('.'); if(n&lt;0) { n=0; } var firsthalf = str1.substring(0, str3+n+1); var secondhalf = str1.substring(str3+n+1, str2); } else { var firsthalf = str1.substring(0, str3+n+4); var secondhalf = str1.substring(str3+n+4, str2); } var addcode=&quot;<center>&quot;+document.getElementById(&quot;addcodemiddle&quot;).innerHTML+&quot;</center><br/>&quot;; var newbody=firsthalf+addcode+secondhalf; var strnew=document.getElementsByClassName(&quot;post-body entry-content&quot;); strnew[0].innerHTML=newbody; document.getElementById(&quot;addcodemiddle&quot;).innerHTML=&quot;&quot;; </script>
</b:if>

Step 4

Replace The Place Your Ad Code Text With Your Adsense Ad Code in the above code and save your template.

So this is how we can add AdSense ads in the middle or anywhere inside our Blogger posts. Don’t worry about violating Google’s Terms of Service because applying this method will not modify the ad’ structure.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close