【问题标题】:Reload Adsense ads, or have to use DFP?重新加载 Adsense 广告,还​​是必须使用 DFP?
【发布时间】:2015-07-29 10:16:06
【问题描述】:

我发现许多网站解释了如何在 30-120 秒后重新加载/刷新 DFP 广告,但没有一个网站解释是否可以使用 Adsense 广告。

我尝试过 DFP - 与 Adsense 相比,它非常令人困惑。

我当前的 Adsense 代码:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- MYSITE- Responsive - #1 -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-123456789..."
     data-ad-slot="123456789"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

【问题讨论】:

    标签: javascript reload ads adsense google-dfp


    【解决方案1】:

    AdSense 的TOS 不允许您所指的那种自动刷新。这并不意味着您不能以编程方式自动刷新 AdSense 代码。这确实意味着您几乎肯定会因此而被禁止。

    另一方面,在使用 AdSense + Doubleclick for Publishers (DFP) 时,这种行为是允许的。 This documentation 应该为您指明正确的方向,并且您需要调用这样的代码来刷新您的广告:

    googletag.pubads().refresh();

    以下教程应为您提供足够的信息来了解如何使用 AdSense + DFP:

    1. General Tutorial #1(已过时,但仍然有用)
    2. General Tutorial #2(同样过时,但仍然有用)
    3. Linking AdSense + DFP(如果您使用 DFP for Small Business,这将不起作用;相反,您只需将 Adsense 嵌入代码添加为第三方广告素材

    如果您坚持在没有 DFP 的情况下自动刷新广告,您可以在计时器函数中执行以下操作:

    document.getElementById('FrameID').contentWindow.location.reload(true);

    请注意:如果您不通过 DFP 使用 AdSense 服务,您将被禁止使用该服务

    【讨论】:

    • 所以您不能(“不能”)仅使用 Adsense 进行此操作,但如果您通过 DFP 使用 Adsense 则可以?
    • @Dave 看到我上面的说明,祝你好运。设置具有自动刷新功能的 AdSense + DFP 并不是一个非常简单的过程。
    • 非常感谢您提供详细信息!我确实想成为“合法”,所以我想我必须接受它并习惯 DFP。欣赏答案和细节。
    • 不清楚,但也许 AdSense 自动刷新是允许的,只要它是用户启动的。请参阅:support.google.com/adsense/answer/1346295#Auto-refreshing_ads。它说:“未经用户请求刷新,发布者不得刷新页面或页面元素。”那么如果用户与网站交互,是否允许广告刷新?
    【解决方案2】:

    在开始&lt;head&gt;标签后面加上这段代码

    <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <script src=’http://connect.kyowal.com/kp_dev/developer/refresh.js’ type=’text/javascript’/>
    <script>
    var adsenceblockone = ‘<ins class=’adsbygoogle’ data-ad-client=’ca-pub-1385863686986530′ data-ad-format=’auto’ data-ad-slot=’5134528809′ style=’display:block’/>‘;
    </script>
    

    将此代码放置在您希望在页面上展示广告的位置

    <div id=”adsrefreshone”></div>
    <script>
    adsencerefreshone();
    </script>
    

    此代码仅适用于一个广告

    如果您想展示更多广告,请在此处阅读全文 http://www.kyowal.com/rsiwal/posts/8702

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-20
      • 2013-02-23
      • 1970-01-01
      • 2013-12-04
      • 2023-03-24
      • 2021-11-01
      相关资源
      最近更新 更多