Forum Moderators: martinibuster
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?
<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.
<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.