- For show adsense ad or any other ads in blogger blog post follow below steps.
First add <!-- adsense --> comment code in your post by HTML section where you want to show this ads our script automatic will replace <!-- adsense --> with your Adsense ad script or with other script you want to use.
- Now we need to add some code in blogger template.
Press CTR+F and Find <data:post.body/> you will find this several time in template replace second number of <data:post.body/> with below given code if it not working by replacing second number this so undo this and try with 3rd and again it not working again undo this and try this with 4th number <data:post.body/> why we try this with all <data:post.body/> because all blogger templates source code structure is different.
<div expr:id='"adsmiddle1" + data:post.id'></div>
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.pageType != "static_page"'>
<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>
Note Replace <!-- Add here the code of your ad --> with you adsense ads code in html encode format use below tool for convert code in encode form.
How to Add Adsense ads inside the post
Reviewed by Unknown
on
10:42
Rating:
No comments: