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?

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 by Eric Z Ma.

Eric Z Ma

Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *