Saturday, December 20, 2014

How to display an AdSense ad in the middle of a post?

Adsense ads in the middle of posts in Blogger is pretty simple

Manually inserting Adsense ads in the middle of posts in Blogger is pretty simple, just follow these steps below:

Search for <data:post.body/>
in the view of html mode of your template editor.

And replace below code on second  <data:post.body/> ( if not working please try the third <data:post.body/> )
 <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>


And now place your encoded ad code below <!-- Add here the code of your ad -->

Save the template.

When you make a new post , go to html view and place
<!-- adsense -->
wherever you need to display google ads .



Siyalla.lk Gannadeshiyade.com

0 comments:

Post a Comment