【问题标题】:Google Adsense Responsive Ads Not ShowingGoogle Adsense 响应式广告未显示
【发布时间】:2016-09-25 18:03:31
【问题描述】:

在以下链接here 中,我有 3 个广告,右/左/标题广告。他们正在使用响应式单元,状态为“活动”,问题是响应式广告没有显示,谷歌搜索显示这是由 CSS 主题引起的,可能广告单元没有占用父 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>

【问题讨论】:

    标签: html css adsense


    【解决方案1】:

    我的建议:在广告代码中,

     display : inline-block
    

    并删除
    data-ad-format="auto"

    如果您的父级潜水尺寸小于可用的广告单元,那么有时广告将不会展示

    【讨论】:

    • 175 x 643, in (min 950px ), 我要试试这个。
    【解决方案2】:
    <ins class="right-ad"
     style="display:inline"
    

    您是否将其添加到广告的 HTML 中?您不应该更改广告代码。对于data-ad-format="auto",广告将适应容器的大小。只需删除您添加到广告代码中的内容并更改容器即可。在您的情况下,&lt;div class="right-ad"&gt; 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"
    

    【讨论】:

    • 这成功了!谢谢!,但它比 div 的大小要小,而且 div 也高于原来的位置。
    • 您只看到它更小。 div 是适合广告的“最大尺寸”,但如果有较小的广告出价更高,则会自动添加它们。其他地方的其他人可能会看到与您不同的广告。 Adsense 将尝试适合您放入的&lt;div&gt; 的不同尺寸的广告,并自动投放最有利可图的广告。还取决于查看广告的设备的屏幕尺寸。请记住将您的
      设为max-width 而不是固定的width,以便它能够响应不同的屏幕尺寸。
    • 在 CSS 中,我为 div 做了一个响应式设计,我在很多网站上看到广告真正适应了 div 规格,比如圆角和阴影。在此,广告不适应阴影、大小或圆角,第一步使其工作完成,谢谢,但设计的主要目标仍然有问题,有什么想法吗? .
    • 广告会适应,但前提是没有更好的小广告。有时较小的广告会有更好的收入,因此它们会被展示。最好的改变是将最大容器尺寸设为常见的广告尺寸,例如 300x250 或 300x600 等。因为有很多广告具有这种尺寸并且适合这些地方。
    猜你喜欢
    相关资源
    最近更新 更多
    热门标签