Forum Moderators: martinibuster

Message Too Old, No Replies

Changing Adsense placement according to device type

Responsive design not enough

         

surfgatinho

12:16 pm on Apr 1, 2016 (gmt 0)

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



I'd like to be able to have a little more control over my Adsense placement when mobiles / tablets are being used. Whilst I can get reasonable results using responsive layouts I would like a bit more control.

My first thought would be to use JS to create a conditional show/hide depending on screen width. Is there a way of doing this that is not going to violate the TOS? I'm assuming I can do it without changing the actual Adsense code itself...

Thanks,
Chris

Rasputin

3:05 am on Apr 2, 2016 (gmt 0)

10+ Year Member



With responsive ads you can use media queries to set the ad size, as you probably realise.
These include a 'display:none' option, so you can set ads in as many places as you like as long as only three are displayed ( you can see code examples in adsense support)
Personally I think this is an easier solution than using javascript and just as flexible.

surfgatinho

6:10 pm on Apr 2, 2016 (gmt 0)

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



Thanks Rasputin. I'd just found figured this out, or at least found a solution here: [productforums.google.com...]

I'm assuming that the ad slot is just skipped if the ''display:none' is used. It's only AFAIK the ad relevance declines after the first ad.