Prebid not attempting to set key values in ad targeting

395 views Asked by At

I am trying to setup prebid on my website and using the sample code from prebid website. Currently i have appnexus and Adx on board, this is the flow in console: https://i.stack.imgur.com/bJeVW.png

As you can see in above image that the flow is perfect except there is no attempt to set key values.

Expected flow should be like this: https://i.stack.imgur.com/5WnVD.png

I don't know whats is causing this.

Below is my code:

        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);
1

There are 1 answers

0
ngIf_happy On

Normally this is because DFP has already set targeting and chosen a winner as well as rendered an Ad for your slots by the time your Prebid app has passed bids to setTargeting. Are you sure you are using disableInitialLoad as well as enableSingleRequest functions with DFP/GAM? Search for these on their Basic Example page to see how they are loading their DFP. If you can send over a link to your page and we could tell you exactly the issue from there too.