Google ad dfp js 代码未呈现所有广告位
Google ad dfp js code is not rendering all ad slots
我需要一些帮助来更好地设置我的 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>
我需要帮助定义所有插槽
可能是您没有足够的广告素材。
示例:假设您的 DFP 广告管理系统有三个 300x250 的广告单元和 1 个订单项,定位所有三个。
- 如果订单项只有一个广告素材,则只有一个广告单元会
渲染它(首先定义的那个)。
- 如果订单项有两个广告素材,则只有一个广告单元为空白。
- 如果你加第三个
有创意,那么这三者都会展示一个广告。
我需要一些帮助来更好地设置我的 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>
我需要帮助定义所有插槽
可能是您没有足够的广告素材。
示例:假设您的 DFP 广告管理系统有三个 300x250 的广告单元和 1 个订单项,定位所有三个。
- 如果订单项只有一个广告素材,则只有一个广告单元会 渲染它(首先定义的那个)。
- 如果订单项有两个广告素材,则只有一个广告单元为空白。
- 如果你加第三个 有创意,那么这三者都会展示一个广告。