2

我正在尝试在我的网站上设置 prebid 并使用 prebid 网站的示例代码。目前我有 appnexus 和 Adx,这是控制台中的流程: https ://i.imgur.com/qme7k26.png

正如您在上图中看到的那样,除了没有尝试设置键值外,流程是完美的。

预期的流程应该是这样的: https ://i.imgur.com/4oPnacA.png

我不知道这是什么原因造成的。

下面是我的代码:

        var unit_728x90 = [
            [728, 90],
            [600, 300]
        ];
        var unit_300x250 = [
            [336, 280],
            [300, 250],
            [300, 100],
            [320, 50]
        ];
        var unit_320x50 = [
            [320, 50]
        ];
        var unit_300 = [
            [300, 250]
        ];
        var PREBID_TIMEOUT =2000;
        var FAILSAFE_TIMEOUT = 3000;
        var ASSERT_TIMEOUT = 1000;

        var adUnits = [{
                code: '21791303143/upl_belowslidem_300x250',
                mediaTypes: {
                    banner: {
                        sizes: unit_300x250
                    }
                },
                bids: [{
                    bidder: 'appnexus',
                    params: {
                        placementId: 17076422
                    }
                }]
            }     
        ];

        var googletag = googletag || {};
        googletag.cmd = googletag.cmd || [];
        googletag.cmd.push(function() {
            googletag.pubads().disableInitialLoad();
        });
         if(window.screen.width < 769){
            googletag.cmd.push(function() {

             });
         }else{
            googletag.cmd.push(function() {
            googletag.defineSlot('/21791303143/upl_belowslidem_300x250', unit_300x250, 'div-side').addService(googletag.pubads());
            googletag.pubads().enableSingleRequest();
            googletag.enableServices();
            });
        }

        var pbjs = pbjs || {};
        pbjs.que = pbjs.que || [];
        pbjs.que.push(function() {
            pbjs.setConfig({ 
                priceGranularity: "high",
                enableSendAllBids: false,
                useBidCache: true
            })
        });

        pbjs.que.push(function() {
            pbjs.addAdUnits(adUnits);
            pbjs.requestBids({
                bidsBackHandler: initAdserver;
                 }
            });
        });

         function initAdserver() {
            if (pbjs.initAdserverSet) return;
            pbjs.initAdserverSet = true;
            googletag.cmd.push(function() {
                pbjs.que.push(function() {
                    pbjs.setTargetingForGPTAsync('div-side');
                    googletag.pubads().refresh();
                });
            });
        }
        setTimeout(function() {
            initAdserver();
        }, FAILSAFE_TIMEOUT);
4

1 回答 1

0

通常这是因为在您的 Prebid 应用程序将出价传递给 setTargeting 时,DFP 已经设置了定位并选择了获胜者并为您的广告位呈现了广告。您确定您使用disableInitialLoad的还有enableSingleRequestDFP/GAM 的功能吗?在他们的基本示例页面上搜索这些以查看他们如何加载 DFP。如果您可以通过链接发送到您的页面,我们也可以从那里准确地告诉您问题。

于 2020-01-31T15:02:37.913 回答