我在我的网站上使用了响应式Google广告,但不幸的是,它一直无法正常工作,大部分时间都在返回
TagError:adsbygoogle.push()错误:availableWidth = 0没有插槽大小
我尝试通过定义广告尺寸来解决问题,但问题仍未得到解决.
.adslot_1 { width: 320px; height: 100px; }
@media (min-width:500px) { .adslot_1 { width: 468px; height: 60px; } }
@media (min-width:800px) { .adslot_1 { width: 728px; height: 90px; } }
@media only screen and (min-width:800px)and (max-width:3000px) {
#topbanner {
width: 640px;
height: 90px;
}
}
Run Code Online (Sandbox Code Playgroud)
好吧,这是我使用的实际Google Adsense Google代码(出于安全考虑,我删除了pub-id和ad-slot.)
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- articles(auto) -->
<ins class="adsbygoogle adslot_1"
style="display:inline-block;"
data-ad-client="ca-pub-[MY_AD_ID]"
data-ad-slot="AD_SLOT_NOS"
data-ad-format="rectangle, horizontal"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Run Code Online (Sandbox Code Playgroud)