Thursday, September 17, 2009

How to put AdSense in the middle of Blogger posts

Some webmasters try to put Adsense in a posting and has proven effective way of improving profits significantly.

There is a simple way how to put AdSense in the middle of a Blogger post, only with JavaScript and a group of some DIVs. Within 2 easy steps:

The first step:

Please log in Blogger, then the layout select edit HTML. In your Blogger template, find the tag <data:post.body/> (you must check Expand Widget Templates in Blogger console) and replace it with following 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>

Note that you must replace <!-- Your AdSense code --> with block code provided by Google.

Step two:

In every blog post: Put a special comment

<! - Adsense ->

in the exact point you want to appear AdSense advertising.

Google automatically inject in your posts up to 3 AdSense blocks. So just the first 3 posts (in a top-down order) in your home page or archive pages will have ads.

4 comments:

  1. Thanks alot for sharing this wonderfull trick..

    ReplyDelete
  2. Hmm, this isn't working for me for some reason. It's as if I've never inserted the code.

    ReplyDelete
  3. thanks Bro, it's work for me Love you
    see it http://nexgendownload.blogspot.com

    ReplyDelete
  4. @ Singaporean in London :

    Try posting word

    <-- adsense --> instead of <-- Adsense -->

    because in the code ,word which has been used


    and author is telling us to use word <-- Adsense -->

    That might be the reason but let me check 1st...
    Regards,

    http://placementpapersanswers.blogspot.com/

    ReplyDelete