1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

AdSense ads in floating box (always visible), how?

Discussion in 'Guidelines / Compliance' started by 7stars7stones, Mar 10, 2005.

  1. #1
    I heard that there is way to insert Google AdSense code (for example: skyscraper) to a floating box or layer.

    Has anyone tried to place the adsense code within such a "floating" layer using DHTML, Javascript or CSC.

    Idea behind this is, that if users scrolls down on the page, adsense ads will stay visible on the right or left side of the screen, floating on the page, always visible.

    Someone mentioned that this can be done easily through CSS positioning, but I have no idea how to do this.

    This would be great for long pages, so that the ads stay in front of the visitors eyes, and as far as I know, this wouldn't be in violation of Google's TOS.

    Can someone please post the code?

    Joe
     
    7stars7stones, Mar 10, 2005 IP
  2. TiGG

    TiGG Peon

    Messages:
    209
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hmmm yeah it can be done very easy with CSS absolute positioning. I had almost decided to do it before but I thought it would be against the TOS. If its not then why doesn't everyone do it! lol

    Any thoughts from adsense vets?
     
    TiGG, Mar 10, 2005 IP
  3. pg20706

    pg20706 Peon

    Messages:
    181
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Interesting, do you have an example(link) for that?
     
    pg20706, Mar 10, 2005 IP
  4. TiGG

    TiGG Peon

    Messages:
    209
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
  5. TiGG

    TiGG Peon

    Messages:
    209
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The following should be inserted in the <HEAD> area of your page:


    <script language="JavaScript1.2">
    var offsetfromedge=10 //offset from window edge when content is "docked". Change if desired.
    var dockarray=new Array() //array to cache dockit instances
    var dkclear=new Array() //array to cache corresponding clearinterval pointers

    function dockit(el, duration){
    if (!document.all) return;
    this.source=document.all? document.all[el] : document.getElementById(el);
    this.source.height=this.source.offsetHeight;
    this.docheight=truebody().clientHeight;
    this.duration=duration;
    this.pagetop=0;
    this.elementoffset=this.getOffsetY();
    dockarray[dockarray.length]=this;
    var pointer=eval(dockarray.length-1);
    var dynexpress='dkclear['+pointer+']=setInterval("dockornot(dockarray['+pointer+'])",100);';
    dynexpress=(this.duration>0)? dynexpress+'setTimeout("clearInterval(dkclear['+pointer+']); dockarray['+pointer+'].source.style.top=0", duration*1000)' : dynexpress;
    eval(dynexpress);
    }

    dockit.prototype.getOffsetY=function(){
    var totaloffset=parseInt(this.source.offsetTop);
    var parentEl=this.source.offsetParent;
    while (parentEl!=null){
    totaloffset+=parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }

    function dockornot(obj){
    obj.pagetop=truebody().scrollTop;
    if (obj.pagetop>obj.elementoffset) //detect upper offset
    obj.source.style.top=obj.pagetop-obj.elementoffset+offsetfromedge;
    else if (obj.pagetop+obj.docheight<obj.elementoffset+parseInt(obj.source.height)) //lower offset
    obj.source.style.top=obj.pagetop+obj.docheight-obj.source.height-obj.elementoffset-offsetfromedge;
    else
    obj.source.style.top=0;
    }

    function truebody(){
    return (document.compatMode!="BackCompat")? document.documentElement : document.body
    }

    if (document.all)
    document.write('<style>.dockclass{position:relative;}</style>')

    </script>

    The following demonstrates the insertion of the Google adsense code - in 120x600 skyscraper form - within a table:

    <table width="125px" border="0" id="google_dock" class="dockclass">

    <center>
    <script type="text/javascript"><!--
    google_ad_client = "pub-123456789";
    google_ad_width = 120;
    google_ad_height = 600;
    google_ad_format = "120x600_as";
    google_color_border = "000000";
    google_color_bg = "000000";
    google_color_link = "FF0000";
    google_color_url = "666666";
    google_color_text = "FFFF00";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </center>
    </table>

    Note the ID and CLASS parameters in the opening TABLE tag above.

    Finally, the following code should be inserted at the bottom of the page, just before the closing </body> tag:


    <script language="JavaScript1.2">
    var dock0=new dockit("google_dock", 0);
    </script>
     
    TiGG, Mar 10, 2005 IP
  6. TiGG

    TiGG Peon

    Messages:
    209
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
  7. TiGG

    TiGG Peon

    Messages:
    209
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    TiGG, Mar 10, 2005 IP
  8. 7stars7stones

    7stars7stones Peon

    Messages:
    368
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Someone mentioned:
    It will be interesting if this flies with the adsense team. This could easily be construed as "promoting" the ads; keep in mind that purposely drawing attention to the ads to increase CTR is forbidden.
    If I were a betting person I would wager it will be added to the TOS no-no's.

    Reply was:
    You could say the same thing about changing the color to a very high contrasting color that attracts the eye? Is that violating Google's rules (given Google lets us change the color ourselves now).

    Another Interesting reply:
    I read through the Adsense TOS, Program Policies and FAQ twice to try and make sure I wasn't missing anything that forbid it and couldn't find anything that seemed to apply. The method is basically the same as if you stuck the ads in a navigation frame on the page (which has been fairly widely done, judging by the people who complain about the ads only targeting the frame), but instead of only getting it's keywords from the frame it can target the entire page.

    I think this seems safe to do.
    Can someone post an example of the CSS version of this?

    This is javascript version (but I would still prefer CSS):

    <script language="JavaScript1.2">
    var offsetfromedge=10 //offset from window edge when content is "docked". Change if desired.
    var dockarray=new Array() //array to cache dockit instances
    var dkclear=new Array() //array to cache corresponding clearinterval pointers

    function dockit(el, duration){
    if (!document.all) return;
    this.source=document.all? document.all[el] : document.getElementById(el);
    this.source.height=this.source.offsetHeight;
    this.docheight=truebody().clientHeight;
    this.duration=duration;
    this.pagetop=0;
    this.elementoffset=this.getOffsetY();
    dockarray[dockarray.length]=this;
    var pointer=eval(dockarray.length-1);
    var dynexpress='dkclear['+pointer+']=setinterval("dockornot(dockarray['+pointer+'])",100);';
    dynexpress=(this.duration>0)? dynexpress+'setTimeout("clearinterval(dkclear['+pointer+']); dockarray['+pointer+'].source.style.top=0", duration*1000)' : dynexpress;
    eval(dynexpress);
    }

    dockit.prototype.getOffsetY=function(){
    var totaloffset=parseint(this.source.offsetTop);
    var parentEl=this.source.offsetParent;
    while (parentEl!=null){
    totaloffset+=parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }

    function dockornot(obj){
    obj.pagetop=truebody().scrollTop;
    if (obj.pagetop>obj.elementoffset) //detect upper offset
    obj.source.style.top=obj.pagetop-obj.elementoffset+offsetfromedge;
    else if (obj.pagetop+obj.docheight<obj.elementoffset+parseint(obj.source.height)) //lower offset
    obj.source.style.top=obj.pagetop+obj.docheight-obj.source.height-obj.elementoffset-offsetfromedge;
    else
    obj.source.style.top=0;
    }

    function truebody(){
    return (document.compatMode!="BackCompat")? document.documentElement : document.body
    }

    if (document.all)
    document.write('<style>.dockclass{position:relative;}</style>')

    </script>



    The following demonstrates the insertion of the Google adsense code - in 120x600 skyscraper form - within a table:


    <table width="125px" border="0" id="google_dock" class="dockclass">

    <center>
    <script type="text/javascript"><!--
    google_ad_client = "pub-123456789";
    google_ad_width = 120;
    google_ad_height = 600;
    google_ad_format = "120x600_as";
    google_color_border = "000000";
    google_color_bg = "000000";
    google_color_link = "FF0000";
    google_color_url = "666666";
    google_color_text = "FFFF00";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </center>
    </table>



    Note the ID and CLASS parameters in the opening TABLE tag above.

    Finally, the following code should be inserted at the bottom of the page, just before the closing </body> tag:


    <script language="JavaScript1.2">
    var dock0=new dockit("google_dock", 0);
    </script>
     
    7stars7stones, Mar 10, 2005 IP
  9. TiGG

    TiGG Peon

    Messages:
    209
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #9
    TiGG, Mar 10, 2005 IP
  10. TiGG

    TiGG Peon

    Messages:
    209
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #10
    But I don't see how the CSS link i posted with the vertical static section could be against TOS its the exact same as a frame on a page only without using those dreaded frames
     
    TiGG, Mar 10, 2005 IP
  11. 7stars7stones

    7stars7stones Peon

    Messages:
    368
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #11
    7stars7stones, Mar 10, 2005 IP
  12. 7stars7stones

    7stars7stones Peon

    Messages:
    368
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Yeah google said: "however we do not allow AdSense participants to move the ads around a page...""

    Well using CSS it is not moving really, it stays in one place, same as if you had a frame on the page and that cannot be against the rules.
     
    7stars7stones, Mar 10, 2005 IP
  13. wendydettmer

    wendydettmer Peon

    Messages:
    1,462
    Likes Received:
    70
    Best Answers:
    0
    Trophy Points:
    0
    #13
    I don't recommend it because as a user it's highly annoying. I don't stay on pages that have that, regardless of the content.

    Just my 2 cents :)
     
    wendydettmer, Mar 10, 2005 IP
  14. seo1

    seo1 Peon

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #14
    This is a popup window. It is a clear violation of TOS. Don't do it!
     
    seo1, Mar 10, 2005 IP
  15. lingeriediva

    lingeriediva Peon

    Messages:
    268
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #15
    You should be able to do it in CSS.

    Something like:

    body {
    background:#fff;
    background-image:url("google code");
    background-position:-20px 0px;

    You would have to fool around with the background position to line it up where you want it on the left hand or right hand side.

    However, I am not sure that the Google code would display in that setup.

    If it were the only thing in the left column it would not be that annoying and would be identical to having the adstrip in a frame....
     
    lingeriediva, Mar 10, 2005 IP
  16. maverick

    maverick Peon

    Messages:
    1,191
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I guess there is no point in even getting close to violation of Google TOS.
     
    maverick, Mar 11, 2005 IP
  17. carmelof

    carmelof Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    I Agree with Wendydettmer, I don't think users like it...after all you can put THREE AdSense ads in a single page: you can put one at the top, one at the middle and the last at the bottom!
    All the best
    Carmelo
     
    carmelof, Mar 11, 2005 IP
  18. TheWebJunkie

    TheWebJunkie Banned

    Messages:
    630
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Yeah floating ads will sure drive visitors away i would never even think about adding these to my sites.
     
    TheWebJunkie, Mar 11, 2005 IP
  19. 7stars7stones

    7stars7stones Peon

    Messages:
    368
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #19
    I've seen it once and it looked fine.
    It was a part of left side panel and it wasn't moving (it was still, along with navigational buttons), it was still and only right side of the page was scrolling.
    Seemed good.
    Anyways, I just wanted to know how to do it.
     
    7stars7stones, Mar 11, 2005 IP
  20. yisou

    yisou Banned

    Messages:
    102
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    It is against TOC, one of my friend did so,and got his account disabled.
     
    yisou, Mar 11, 2005 IP