How to put Adsense code in middle of blogger post
To put adsense code in the blog post, it is better parse the code first.So parse it using AdParser.
Log in to your dashboard--> layout- -> Edit HTML
Check on "Expand Widget Templates"
Now find out the following tag:-
<data:post.body/>
Now replace above code with below code.
<div expr:id='"aim1" + data:post.id'></div><div style="clear:both; margin:10px 0">
<!-- Your AdSense code here -->
</div>
<div expr:id='"aim2" + data:post.id'>
<data:post.body/>
</div>
<script type="text/javascript">
var obj0=document.getElementById("aim1<data:post.id/>");
var obj1=document.getElementById("aim2<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>Now save your template.
Now in every blog post ,Put this special code : <!-- adsense --> in the place where you want to show your adsense ads.
In my blog layout Template there is no "Expand Widget Templates". I understand Google has replaced this with " Revert to. etc"
ReplyDeleteAnd the following tag:-
can not be found.