在移动设备上删除Adsense [英] Remove adsense on mobile

查看:113
本文介绍了在移动设备上删除Adsense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做响应式设计,但是在adsense上遇到了麻烦.

I'm working on my responsive design but having trouble with adsense.

我有一个广告,该广告应显示在桌面设计上,而不显示在移动设计上. 因此,仅当在台式机上查看网站时,才应将广告代码放置在html中. CSS可能会使用display:无,但这是针对adsense TOS的,因此不是解决方案.

I have an ad which should show up on the desktop design, but not on the mobile design. So the code of the ad should be placed in the html only if the website is viewed on a desktop. It's possible with css using display: none, but this is against adsense TOS, so not a solution.

我认为使用 http://mobiledetect.net 这样的PHP类是可能的,但我更喜欢检查浏览器的宽度然后决定要怎么做.

I think it's possible with a PHP class like http://mobiledetect.net but I prefer to check the browser width and then decide what to do.

Adsense的批准示例如下,但是我可以将其用于目标吗?

Adsense has an approved example as below, but can I use it for my goal?

<script type="text/javascript">
google_ad_client = "ca-publisher-id";
width = document.documentElement.clientWidth;
google_ad_slot = "1234567890";
google_ad_width = 320;
google_ad_height = 50;
if (width > 500) {
    google_ad_slot = "3456789012";
    google_ad_width = 468;
    google_ad_height = 60;
}
if (width > 800) {
    google_ad_slot = "2345678901";
    google_ad_width = 728;
    google_ad_height = 90;
}
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

我希望有人能指出我正确的方向.

I hope someone can point me in the right direction.

推荐答案

我已经与荷兰AdSense支持小组联系,并得到了一个令人惊讶的答案,我在互联网上还没有找到.

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

显然,在使用自适应Adsense代码时,允许使用display:none. 这是支持团队的某人发送给我的代码:

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>

请注意,仅当使用自适应AdSense代码时才允许!

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

由于广告实施政策,我对他发送给我的方法表示担忧. ,其中明确指出display:none必须避免.他认为这篇文章对于新的自适应广告已经过时了.

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.

他问了一位同事,并确认上述代码是允许的.虽然,我仍然希望社区或其他AdSense支持团队的人进行确认,只是为了确保! :D

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

这篇关于在移动设备上删除Adsense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆