Welcome to WebmasterWorld Guest from

Forum Moderators: martinibuster

Message Too Old, No Replies

4 AdSense ads but show only 2

6:48 am on May 9, 2013 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 10, 2004
posts: 91
votes: 6

I just made my site responsive and when the screen is wide (more than 700px) it shows a side template on the side of the page with 2 ads. Using media queries when the screen is less than 700px it hides the side template and show two other templates, one at the bottom and the other one on top.

Is that the correct way to do it? would I get penalize for having 4 codes in the same page?
11:46 am on May 11, 2013 (gmt 0)

Preferred Member

10+ Year Member

joined:June 9, 2005
votes: 0

If you're using css media queries to hide/show the extra ads (eg display:none / block or whatever), then no, that is not allowed. All 4 will load, they're just not visible, which is against the TOS.

Google has recently written this about responsive websites which does provide an alternative:

Sorry, I can't find that in English, but translate works enough to get the idea across.

It's not the smoothest solution, but it's the only way I've seen that's 'Google approved'.
2:21 pm on May 13, 2013 (gmt 0)

New User

5+ Year Member

joined:Aug 30, 2012
posts: 11
votes: 0

Sadly, the code referenced by LunaC could also get you in trouble. I had one member of the AdSense team tell me it's ok to use that code, only to get another team member tell me a few weeks later that its not ok and that the first team member was wrong. (Rolling Eyes).

Anyway, I'm now using the Adzerk ad server to serve my AdSense ads. It allows you to load or not (Adsense) ads depending on browser width:


This should be completely safe as you don't need to modify the AdSense code and you only load needed ads depending on your browser width, not resorting to CSS show/hide tricks.
11:17 am on May 14, 2013 (gmt 0)

Preferred Member

10+ Year Member

joined:June 9, 2005
votes: 0

Hmm, A case of one hand not knowing what the other hand is doing at Google I'd guess... Sadly that isn't terribly surprising.

A translation of the red text:
"Please note that it is in accordance with the AdSense program policies , not permitted to make changes to the AdSense code . This is the only recommended change of the code for responsive design websites. Any change that does not meet the above JavaScript code will be considered a violation of our program policies."

Maybe they mean having one not load at all on small screens or something? eg: else { } Who knows... Google is a mystery.

Either way, in that case, it may be better to go with Adzerk or something else.

Having to second guess each move and question what Google 'really means' when they say anything makes me a sad panda. :(