【发布时间】:2014-09-25 13:59:19
【问题描述】:
如何在一个网站上拥有多个 AdSense 单元? Google 给出的唯一代码是单位代码。
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:250px"
data-ad-client="ca-pub-123456"
data-ad-slot="123456"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
如果我想在一个网站上使用多个 AdSense 单元怎么办?我只使用<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> 和(adsbygoogle = window.adsbygoogle || []).push({}); 一次,然后将<ins ...></ins> 代码放在我想要的位置。
问题是只有第一个 adsense 单元被解析和显示。您需要做什么才能显示多个 AdSense 单元?
这就是我使用它的方式(只显示第一个ins):
<!doctype html>
<html>
<body>
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:250px"
data-ad-client="ca-pub-123456"
data-ad-slot="first"></ins>
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:250px"
data-ad-client="ca-pub-123456"
data-ad-slot="second"></ins>
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:250px"
data-ad-client="ca-pub-123456"
data-ad-slot="third"></ins>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
</body>
</html>
【问题讨论】:
标签: adsense