Saturday, January 7, 2012

How to put adsense code in the middle of blogger posts

In this post we are going to discuss one of the effective method to increase the page CTR.
Putting your adsense code  in the middle of blogger posts for incresing ctr  is very simple.

How to put  adsense code in the middle of blogger posts

FIRST STEP 


Parse your adsense code, many online encoders are avalable.
Below given is a screen shot showing parsed adsense code.


NEXT STEP 

Login to your blogger dashboard.
Under "DESIGN" tab click "Edit Html".
Click expand your widget templates and press ctrl + F.
Now Type and search for  <data:post.body/>
<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>

Copy and replace <data:post.body/> with the above code.
Note that you must replace <!-- Your AdSense code here --> with your parsed code
as mentioned in the first step and save your template.
Last Step: For Showing Ads In The Middle

Put this code <!-- adsense --> inside blog posts exactly
where you want to display your adsense ad.



1 comment:

  1. This isn't working for me. If I try to replace the entire with my parsed code, nothing shows up when I add the into the html of a post.

    If I replace onlt the "your adsnse code here" with my parsed code so that it reads then I get an error when previewing the new template that says "Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
    XML error message: The string "--" is not permitted within comments.

    Error 500"

    Please help! I'd appreciate a reply, unlike most tip blogs out there that never respond to comments.

    ReplyDelete