Welcome to WebmasterWorld Guest from 54.145.85.87

Forum Moderators: incrediBILL & martinibuster

Adsense in divs that don't display on some screen sizes

     
8:03 am on May 18, 2017 (gmt 0)

Moderator from GB 

WebmasterWorld Administrator ianturner is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 19, 2001
posts: 3606
votes: 36


I'm looking to go fully responsive with my design layout (rather than responsive with server side assist)

This is causing a problem with my right floated ads as they are not shown on mobile devices. Is it okay to have these in a div that doesn't display on mobile? Or is there another solution to allow these ads to just display on desktop.
10:00 am on May 18, 2017 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:May 11, 2015
posts:177
votes: 58


If you're on wordpress I can highly recommend the plugin called AmpedSense. Does exactly that
10:39 am on May 18, 2017 (gmt 0)

Full Member

Top Contributors Of The Month

joined:Apr 20, 2017
posts:214
votes: 33


In javascript , I test the screen width to select which code to insert (or not).
11:51 am on May 18, 2017 (gmt 0)

Moderator from GB 

WebmasterWorld Administrator ianturner is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 19, 2001
posts: 3606
votes: 36


JavaScript will work but isn't perfect when display width changes - such as the portrait to landscape change on most mobiles/tablets
2:30 pm on May 18, 2017 (gmt 0)

Preferred Member from ES 

10+ Year Member Top Contributors Of The Month

joined:Mar 4, 2003
posts: 470
votes: 4


If you are using responsive ads, you can set them to not show on certain screen sizes with a media query.
6:11 pm on May 18, 2017 (gmt 0)

New User

joined:Nov 15, 2015
posts: 26
votes: 1


Yep, as denisl says, CSS media queries are the way to go .... recommended by Google too, here's the Google support page on media queries and adsense

[support.google.com ]

(Hope the link is OK, mods?)
5:02 pm on May 20, 2017 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:May 11, 2015
posts:177
votes: 58


jbnz has the solution, just tried on my responsive ads
1:57 am on June 7, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Apr 1, 2016
posts: 877
votes: 222


One warning, be sure that you media query targets the <ins> tag and not the parent div. If you simply set the parent div to display:none, then the ad may still be requested but not shown. The class must be attributed to the <ins> tag in the ad code as shown on the Google support page linked by jbnz.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members