How to remove AdSense ads for mobile devices while keep them for desktops?

I want to add adsense ads to be shown to visitors on desktop only.

How to remove AdSense ads for mobile devices?

asked Dec 11, 2014 by anonymous

1 Answer

You can achieve this through using "Responsive ad unit" of AdSense.

The support article Create a responsive ad unit from AdSense discusses this and gives an example. Check the "Hiding an ad unit" section.

I highlight the important parts here:

<style type="text/css">
@media (max-width: 400px) { .adslot_1 { display: none; } }
</style>
<ins class="adsbygoogle adslot_1"
   data-ad-client="ca-pub-1234"
   data-ad-slot="5678"></ins>

Note that it deleted the default style="display:block;" from the <ins></ins> tag.

answered Dec 11, 2014 by Eric Z Ma (44,280 points)
edited Dec 11, 2014 by Eric Z Ma

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...