Wednesday, October 7, 2009

How to add AdSense Adds in the middle of Blogger posts

Is it possible to add Google adsense ads in the middle of your posts? Yes it is possible and not only that, you also can choose where you want to put your adsense ad in your blog post. Besides it looked more professional, many blogger use this hack in the hope of getting more clicks on their adsense so that they earn more money.
Ok lets get started..
  • First step, of course you need to login inside your Blogger account using your username and password.
  • Then, on your dashboard, click Layout > Edit HTML and tick Expand Widget Templates above the template HTML box.
  • Press Ctrl + F to find this code:

    <data:post.body/>

    and replace the above code with all the codes below:

    <div expr:id='"aim1" + data:post.id'></div>

    <div style="clear:both; margin:10px 0">

    PLACE 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>

    Before you insert your Google adsense ads code, you need to parse it first. Click here to find out what is meant by parsing the code. To parse your adsense code you can simply go to http://blogcrowds.com/resources/parse_html.php

    Note: if you have the “Read More” hack installed on your blog, you will find two similar code of <data:post.body/> then you change or replace the first one.
  • After that save your template and its done!
  • You now can write your post as usual and when you want to place your adsense ads somewhere in the post, just insert this tag <!-- adsense --> and your adsense ads will automatically appear on that spot.

No comments:

Post a Comment