1

我目前正在试用效果很好的 Google Adsense 响应式广告,但是有没有办法在屏幕尺寸超过特定尺寸时显示两个广告?

例如,当屏幕尺寸大于 620 像素时,显示两个相邻的“250 x 250”广告(而不是一个)?

4

1 回答 1

1

您可能不会放置两个广告(没有一些可能导致各种问题的服务器端编码),但您可以增加或减小广告的大小以使用媒体查询实现类似的行为。例如:您可以显示 -

  1. 手机上的 300x250 广告
  2. 平板电脑上的 336x280 广告(最小宽度为 500)
  3. 桌面上的 728x90 广告(最小宽度为 800)
  4. 大分辨率桌面上的 970x250 广告(最小宽度为 1200)

为此,您需要在“自适应广告”中使用高级代码(需要修改代码),如下所示 -

<style>
.responsive2 { width: 300px; height: 250px; }
@media(min-width: 500px) { .responsive2 { width: 336px; height: 280px; } }
@media(min-width: 800px) { .responsive2 { width: 728px; height: 90px; } }
@media(min-width: 1200px) { .responsive2 { width: 970px; height: 250px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Responsive2 -->
<ins class="adsbygoogle responsive2"
     style="display:inline-block"
     data-ad-client="ca-pub-XXXXX"
     data-ad-slot="YYYYY"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

有关高级响应式 AdSense 广告的更多详细信息,请参阅https://support.google.com/adsense/answer/3543893#adv

于 2014-09-29T08:05:50.170 回答