0

我想要一个提供 5 个横幅并在它们之间旋转的订单项。到目前为止,一切都很好。这很容易。

现在我不想惹恼用户并且想要某种广告暂停。就像每 5 次中的 1 次一样,不显示广告。

我尝试创建空广告素材并调用collapseEmptyDivs(true),但无法创建空广告素材。有没有人知道如何在 DFP 中创建空白/空广告素材

4

1 回答 1

0

according to the GPT documentation (here) about collapsEmptyDivs(true) :

Enables collapsing of slot divs so that they don't take up any space on the page when there is no ad content to display.

This means the ad slots will collapse only if there is no ad to display. Therefore, no need to create an empty ad on Google Ad Manager Interface. To make it work properly, collapseEmptyDivs will need to be declared on your page when you define the GPT tag options (in head scripts). Here is a sample :

<script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'></script>
<script>
  var googletag = googletag || {};
  googletag.cmd = googletag.cmd || [];
</script>
<script>
    googletag.cmd.push(function() {
    // Start: GPT Adslot Definition
    googletag.defineSlot('gamNetworkId/siteName/sitePage', [[300,250], [300,600]], 'pave').addService(googletag.pubads());

    //generic options
    googletag.pubads().enableSingleRequest();
    googletag.pubads().setCentering(true);
    googletag.pubads().collapseEmptyDivs(true);
    googletag.enableServices();
  });
</script>

On Google Ad Manager interface : you just have to apply a capping on your current line item to make sure the users will not see "too much" ads.

于 2019-04-09T10:28:34.890 回答