Prebid.js没有将出价传递给DFP

时间:2018-07-15 08:28:44

标签: prebid.js

我从Prebid.js中举了一个例子,并在代码中更改了出价人。

奇怪的是,尽管我有一个出价响应,但它没有通过 prev_scp参数传递给DFP,没有呈现,也没有显示在 getAllPrebidWinningBids

pbjs.getBidResponse()返回出价

pbjs.getAllWinningBids()返回一个空数组

pbjs.getAllPrebidWinningBids()返回一个空数组

enter image description here

HTML:

        <script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
        <script async src="//acdn.adnxs.com/prebid/not-for-prod/1/prebid.js"></script>
        <script>
            var sizes = [
                [300, 250]
            ];
            var PREBID_TIMEOUT = 1700;

            var adUnits = [{
                code: '/19968336/header-bid-tag-1',
                mediaTypes: {
                    banner: {
                        sizes: sizes
                    }
                },
                bids: [{
                    "bidder": "ix",
                    "params": {
                        "id": "07",
                        "siteId": "272669",
                        "size": [
                            300,
                            250
                        ],
                        "floor": 0.6,
                        "bidfloorcur": "USD"
                    }
                }]
            }];

            // ======== DO NOT EDIT BELOW THIS LINE =========== //
            var googletag = googletag || {};
            googletag.cmd = googletag.cmd || [];
            googletag.cmd.push(function() {
                googletag.pubads().disableInitialLoad();
            });

            var pbjs = pbjs || {};
            pbjs.que = pbjs.que || [];

            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();
                        googletag.pubads().refresh();
                    });
                });
            }

            setTimeout(function() {
                initAdserver();
            }, PREBID_TIMEOUT);

            googletag.cmd.push(function() {
                googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1')
                    .addService(googletag.pubads());
                googletag.pubads().enableSingleRequest();
                googletag.enableServices();
            });

        </script>

    </head>

    <body>
        <h2>Basic Prebid.js Example</h2>
        <h5>Div-1</h5>
        <div id='div-1'>
            <script type='text/javascript'>
                googletag.cmd.push(function() {
                    googletag.display('div-1');
                });
            </script>
        </div>
    </body>

要使它正常工作,我缺少什么?

1 个答案:

答案 0 :(得分:0)

好。问题出在PREBID_TIMEOUT。拍卖完成前,已将initAdserver解雇。增加超时后,一切都按预期工作。