Friday, December 19, 2008

Google Ads In Middle Of The Post In Blogger


Problem

In the famous Google AdSense heat map are reported the most profitable areas where to put advertising for your site or blog.
There is no mention of a placement in the middle of your posts. Why?
Because by default Blogger, the blogging platform offered by Google, doesn’t offer a way to break a post in the middle and put there an ad.
But, if you search very carefully on the Net, you’ll find that several webmasters tried to put ads in that position and report a significant increase in profits.

This site doesn’t confirm an increase in profits when an ad is in the middle of a post, but explains how to put AdSense in the middle of a Blogger post.


Solution

There is a simple way to solve this problem: move post body around the advertising code, just with a bunch of JavaScript and a couple of DIVs. In 2 easy steps:

  • In your Blogger template:


    OLD BLOGGER

    Find the tag <$BlogItemBody$> and replace it with following code:

    <div id="prv<$BlogItemNumber$>"></div>

    <div style="clear:both;margin:10px 0">
      <!-- Your AdSense code -->
    </div>

    <div id="fst<$BlogItemNumber$>">
      <$BlogItemBody$>
    </div>

    <script type="text/javascript">
    var obj0=document.getElementById("prv<$BlogItemNumber$>");
    var obj1=document.getElementById("fst<$BlogItemNumber$>");
    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>


    NEW BLOGGER

    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.


  • In every blog post:

    Put a special comment
    <!-- adsense -->
    in the exact point you want to appear AdSense advertising.
    Done!
  • 0 comments:

    Friends

    Popular Posts

    Advertisement

     

    Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com