Forum Moderators: martinibuster

Message Too Old, No Replies

How to switch between different AdSense formats

depending on the screen resolution

         

Philarmon

3:17 am on Nov 5, 2003 (gmt 0)

10+ Year Member



Hello!

I am curious if it is possible to display various formats depending of the user's screen resolution. In particular, i want to show a 468x60 ad to the users with 800x600 resolution and the leaderboard to all others.

I mean, i know how to detect the resolution with javascript and display the ads depending on that, but then i would have to modify the AdSense code a bit (enter an "if" statement in the second part of code) what is a no no according to Google.

Is there any way?
Thanks!

olsonnet

3:35 am on Nov 5, 2003 (gmt 0)

10+ Year Member



I don't think you would be modifying the adsense code - you would just have 2 (original) blocks of code of which only one would be shown.

Brad

danny

7:49 am on Nov 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The only way to be sure is to ask Google. I've thought about doing this myself (though I can't get the CSS working), so I'd be interested to know what they say.

EVOrange

2:49 pm on Nov 5, 2003 (gmt 0)

10+ Year Member



I would like to have an example of how this would work?
I have found scripts that detect screen resolution, but I'm not adept enough to know how to apply it to two different Google ads.

Thanks.

EVO

danny

10:16 pm on Nov 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's probably not screen resolution you care about, but browser window width. So something as simple as

if (window.outerWidth < 900 ¦¦ document.body.clientWidth < 900) {
# set variables for banner
} else {
# set variables for leaderboard
}

But CHECK WITH GOOGLE THAT THIS IS ALLOWED. Arguably it's within the spirit but not the letter of the rules.

Philarmon

10:39 pm on Nov 5, 2003 (gmt 0)

10+ Year Member



I have asked Google about that and got a response today:

"While we can answer specific questions about the AdSense ad code, we are unable to provide support for general HTML or other scripting questions."

Hmm, very helpful :) Now what?