Place Adsense Ads In The Middle/Inside blogger Posts

If you are an adsense publisher who want to place an adsense ads in the middle or anywhere inside blogger posts, i will give you an easy way to do that. With the following trick you will be able to put an ads in the middle post like this.


The following tutorial, we can manipulate the location of the ads to be displayed by adding a script inside the template and using a tag inside our post to where we want the AdSense Ads to appear. Once added, we can place the ads anywhere, be it between paragraphs or in the middle of the content using a code in the posts html.

How to Place Adsense Ads In The Middle/Inside Posts

Before proceeding, it is recommended to backup your template: go to "Template" and click on the "Backup/restore" button to save a copy on your hard drive.

Step 1. First thing we need to do is to parse the AdSense code and convert it to plain text Google.
Step 2: Login to your blogger account and select the blog you want to edit.
Step 3: Go to Theme and click on Edit HTML.
Step 4: Click anywhere inside the code area.
Step 5: Press Ctrl+F from keyboard to open a search bar.
Step 6: Now search <data:post.body/> code and replace this code in your template with the following code.
Tips: Inside of your template, you will find <data:post.body/> code multiple time depending on the template used, first try the third one. if there's no change try the second or first code until the ad appears on the article page.
<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 7. Add the converted Adsense code on where you see the <!-- Add here the code of your ad --> annotation, then save the changes.

Tips: 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 8. 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:
This is a demo text. This is a demo text.
This is a demo text. This is a demo text.
This is a demo text. This is a demo text.
This is a demo text. This is a demo text.
This is a demo text. This is a demo text.
<br /><br /> <!-- adsense -->
This is a
demo text. This is a demo text. This is a
demo text. This is a demo text. This is a
demo text. This is a demo text. This is a
demo text. This is a demo text. This is a
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.

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

Post a Comment

Copyright © How To. Designed by OddThemes and Seotray