Google广告DFP JS代码未呈现所有广告位

时间:2019-06-10 17:59:11

标签: javascript gpt

我希望获得一些帮助,以更好地设置我的Google dfp代码。

我已经尝试过分别设置广告位,但它不会呈现所有广告位。

这是添加代码代码定义:

<script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'></script>
<script>
  var googletag = googletag || {};
  googletag.cmd = googletag.cmd || [];
</script>
<script type="text/javascript">
  googletag.cmd.push(function() {
    googletag.defineSlot('#########/accessnepa', [[300,600]], 'div-gpt-ad-ROS')
             .setTargeting('position', ['ATF'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-EatDrink-1')
              .setTargeting('position', ['BTF'])
              .setTargeting('Category', ['EatDrink'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-EatDrink-2')
             .setTargeting('position', ['BTF2'])
             .setTargeting('Category', ['EatDrink'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-ChefTable')
             .setTargeting('position', ['ATF'])
             .setTargeting('setTargeting', ['Category', 'ChefTable'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-LocalFlavor')
             .setTargeting('position', ['ATF'])
             .setTargeting('setTargeting', ['Category', 'LocalFlavor'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-EmptyBottles')
             .setTargeting('position', ['ATF'])
             .setTargeting('setTargeting', ['Category', 'EmptyBottles'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-Liquid')
             .setTargeting('position', ['ATF'])
             .setTargeting('setTargeting', ['Category', 'Liquid'])
             .addService(googletag.pubads());

    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-HealthBeauty')
               .setTargeting('position', ['ATF'])
               .setTargeting('Category', ['HealthBeauty'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-HealthBeauty-2')
             .setTargeting('position', ['BTF'])
             .setTargeting('Category', ['HealthBeauty'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-HeyBeautiful')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['HeyBeautiful'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-LiveFit')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['LiveFit'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-ScreenTime')
             .setTargeting('position', ['BTF'])
             .setTargeting('Category', ['ScreenTime'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-ScreenTime-2')
             .setTargeting('position', ['BTF2'])
             .setTargeting('Category', ['ScreenTime'])
             .addService(googletag.pubads());

    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-Take2')
             .setTargeting('position', ['ATF'])
             .setTargeting('setTargeting', ['Category', 'Take2'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-HistoricallyHip')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['HistoricallyHip'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-HistoricallyHip-2')
             .setTargeting('position', ['BTF'])
             .setTargeting('Category', ['HistoricallyHip'])
             .addService(googletag.pubads());
       googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-SportsOutdoors')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['SportsOutdoors'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-SportsOutdoors-2')
             .setTargeting('position', ['BTF'])
             .setTargeting('Category', ['SportsOutdoors'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-PagesFromThePast')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['PagesFromThePast'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-CausesBenefits')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['CausesBenefits'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-CausesBenefits-2')
             .setTargeting('position', ['BTF'])
             .setTargeting('Category', ['CausesBenefits'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-InTimesOfNeed')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['InTimesOfNeed'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-TalkOfTheTimes')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['TalkOfTheTimes'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-UpClose')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['UpClose'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-UpClose-2')
             .setTargeting('position', ['BTF'])
             .setTargeting('Category', ['UpClose'])
             .addService(googletag.pubads());

    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-TrailMix')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['TrailMix'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-PennState')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['PennState'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-Railriders')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['RailRiders'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-HSSports')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['HSSports'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-Multimedia')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['Multimedia'])

.addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-Multmedia-2')
             .setTargeting('position', ['BTF'])
             .setTargeting('Category'['Multimedia'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-Podcasts')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['Podcasts'])
             .addService(googletag.pubads());
    googletag.defineSlot('#########/accessnepa', [[300,250]], 'div-gpt-ad-PhotoBlog')
             .setTargeting('position', ['ATF'])
             .setTargeting('Category', ['PhotoBlog'])
             .addService(googletag.pubads());

      googletag.pubads().enableSingleRequest();
    //  googletag.pubads().setTargeting("Category",['EatDrink'], ['ROS'], ['ChefTable'], ['LocalFlavor'], ['EmptyBottles'], ['Liquid'], ['HealthBeauty'], ['HeyBeautiful'], ['LiveFit'], ['ScreenTime'], ['Take2'], ['HistoricallyHip'], ['PagesFromThePast'], 
  // ['CausesBenefits'], ['InTimesOfNeed'], ['TalkOfTheTimes'], ['UpClose'], ['SportsOutdoors'], ['TrailMix'], ['PennState'], 
  // ['RailRiders'], ['HSSports'], ['Multimedia'], ['Podcasts'], ['PhotoBlog']);
googletag.enableServices();
  });
</script>

我需要定义所有插槽的帮助

1 个答案:

答案 0 :(得分:0)

可能是您的广告素材不足。

示例:假设您的DFP广告管理系统具有三个300x250广告单元和一个订单项,分别针对这三个目标。

  • 如果订单项仅包含一个广告,则只有一个广告单元 渲染它(首先定义的那个)。
  • 如果订单项包含两个广告,则只有一个广告单元为空白。
  • 如果添加第三个 广告素材,那么这三个广告都将展示一个广告。