Remove adsense on mobile

女生的网名这么多〃 提交于 2019-12-04 09:51:38

I've contacted the Dutch AdSense support team and got a surprising answer, which I haven't found on the internet yet.

Apparently it is allowed to use display:none when using responsive adsense code. Here is the code that someone from the support team sent to me:

<style>
  .responsive-test { display: block;}
  @media(max-width: 480px) { .responsive-test { display: none; } }
</style>

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Resposive_TEST -->
<ins class="adsbygoogle responsive-test"
  data-ad-client="ca-pub-3086914080036003"
  data-ad-slot="1408862175"
  data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

Note that it's only allowed when using the responsive adsense code!

I expressed my concerns about the method he sent me, because of the ad implementation policies, which clearly state that display:none has to be avoided. He thinks this article is outdated for the new responsive ads.

He asked one of his colleagues, and also confirmed that the above code is allowed. Although, I still want someone from the community or other AdSense support team to confirm, just to make sure! :D

You can try something like this to avoid loading the JS on mobile but you should confirm with your AdSense manager if this change is allowed or now.

if (width >= 480) {
  document.write('<script src="show_ads.js"><\/script>');
}

You could try the approach by Labnol Google adsense responsive design , Google Approved

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!