Forum Moderators: martinibuster

Message Too Old, No Replies

Hiding AdSense with CSS

what is your opinion?

         

moltar

2:17 am on Mar 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It was suggested in a recent thread (What to do when you're kicked out of Adsense [webmasterworld.com]) to hide the ads from users that live in publisher's locality.

I was wondering if the following approach would be acceptable.

I have all the ads in their own

<div>
s for better control over positioning/colors and such. The
<div>
s always have unique ids. I want to include a dynamically generated CSS file (script). The script will decide whether to display the ads to a user or not based on geo targeting. Like:

@import url("/cgi-bin/ads.pl");

It will either return

#adsense { display: none }
or nothing at all.

The reason I want to go this route is simple. I have 3 ad blocks running on each page. Some of the pages are static, some get generated dynamically. It would be difficult, or almost impossible to get control over all of the ads. This would be an easy solution. Plus CSS will get cached and it will only add a little extra load on my server. Instead of running geo targeting script 3 times on every page load.

I also want to combine the above script with suggestions from "Rotating" AdSense ads with images test [webmasterworld.com] thread.

Do you think hiding AdSense code with CSS would be ok from Google point of view?

asp4bunnies

4:07 am on Mar 30, 2005 (gmt 0)

10+ Year Member



Why not? It might hurt your CTR though, which in turn could negatively effect your smart pricing (that's a guess on my part). Correct me if I'm wrong, but the google ad would still be loaded, just stored in a hidden div?

moltar

5:08 am on Mar 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep. Just tested it with an image in a hidden
<div>
. Logs show that the image is requested even if it's hidden.

Well, I guess loading 1/10 won't work. At least I can hide it from my local area. I am sure it won't significantly affect my CTR. Maybe by 0.00001% :) My sites have nothing to do with my local area.

jetteroheller

6:35 am on Mar 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Why sould it be 3 calls to display 3 add units?

With SSI, You can do it with only one call

The cgi script can return

<div style=top:50;left:50>
code for ad 1
</div>

<div style=top:250;left:350>
code for ad 2
</div>

<div style=top:50;left:50o>
code for ad 3
</div>

moltar

3:22 pm on Mar 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



jetteroheller, this does not always work. First of all I want ads be closer to certain content areas. The other thing one of my ads is at the end of the content, which is different on each page.

jetteroheller

4:25 pm on Mar 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I just thought to have a solution:

<div id=ad1></div>
Here goes Your content
<div id=ad2></div>
Your content continues
<div id=ad3></div>

Here block with server side include

<div id=src1>AdSense code</div>
<div id=src2>AdSense code</div>
<div id=src3>AdSense code</div>

<script>
document.getElementById("ad1").innerHTML=
document.getElementById("src1").innerHTML;
</script>

But I remembered that I found out last month,
that this trick with the innerHTML causes a reload
of the ads.

I had a mouse over to exchange menus.
In one of the menus was Adsense.
Each mouse over invoking a Javascript which
moved around the <div> with the AdSense code
inside caused a new ad to appear.

So again no good tip, just that You do not
waste the time trying this trick.