Google Adsense 自适应广告未展示
Google Adsense Responsive Ads Not Showing
在下面的 link here 中,我有 3 个广告,右/左/Header 个广告。他们正在使用 Responsive Units,状态是 "Active",问题是 Responsive ads 没有显示,谷歌搜索显示这是由 CSS 主题引起的,也许 Ad units 没有占用大小parent div .
我尝试了以下方法:
<div class="right-ad">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline"
data-ad-client="ca-pub-1588985522291479"
data-ad-slot="8975496541"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
2 :
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="right-ad"
style="display:inline"
data-ad-client="ca-pub-1588985522291479"
data-ad-slot="8975496541"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
仍然是空白,CSS 如下(最小 950px):
margin-right: 1%;
position: relative;
width: 13%;
height: 100%;
margin-top:1em;
float:right;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
border-bottom-left-radius: 2px;
box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 4px, rgba(0, 0, 0, 0.0980392) 0px 0px 3px;
为什么还是空白?
编辑:
</div>
<div class="left-ad">
<script async
src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1588985522291479"
data-ad-slot="8975496541"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
我的建议:在广告代码中,
display : inline-block
并移除
data-ad-format="auto"
如果您的父潜水尺寸小于可用的广告单元,那么有时广告不会展示
<ins class="right-ad"
style="display:inline"
您是否将此添加到广告的 HTML?您不应该更改广告代码。对于 data-ad-format="auto"
,广告将适应容器的大小。只需删除您添加到广告代码中的内容并更改容器即可。在您的情况下,<div class="right-ad">
div.
这是常规广告代码的样子
<div class="my-container" style="width: 500px; height: 300px">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-XXXXXXXXXXX"
data-ad-slot="XXXXXXXXXXX"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
所以,你的 style="display:inline"
应该是
style="display:block"
在下面的 link here 中,我有 3 个广告,右/左/Header 个广告。他们正在使用 Responsive Units,状态是 "Active",问题是 Responsive ads 没有显示,谷歌搜索显示这是由 CSS 主题引起的,也许 Ad units 没有占用大小parent div .
我尝试了以下方法:
<div class="right-ad">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline"
data-ad-client="ca-pub-1588985522291479"
data-ad-slot="8975496541"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
2 :
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="right-ad"
style="display:inline"
data-ad-client="ca-pub-1588985522291479"
data-ad-slot="8975496541"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
仍然是空白,CSS 如下(最小 950px):
margin-right: 1%;
position: relative;
width: 13%;
height: 100%;
margin-top:1em;
float:right;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
border-bottom-left-radius: 2px;
box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 4px, rgba(0, 0, 0, 0.0980392) 0px 0px 3px;
为什么还是空白?
编辑:
</div>
<div class="left-ad">
<script async
src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1588985522291479"
data-ad-slot="8975496541"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
我的建议:在广告代码中,
display : inline-block
并移除
data-ad-format="auto"
如果您的父潜水尺寸小于可用的广告单元,那么有时广告不会展示
<ins class="right-ad"
style="display:inline"
您是否将此添加到广告的 HTML?您不应该更改广告代码。对于 data-ad-format="auto"
,广告将适应容器的大小。只需删除您添加到广告代码中的内容并更改容器即可。在您的情况下,<div class="right-ad">
div.
这是常规广告代码的样子
<div class="my-container" style="width: 500px; height: 300px">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-XXXXXXXXXXX"
data-ad-slot="XXXXXXXXXXX"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
所以,你的 style="display:inline"
应该是
style="display:block"