Player + page prebid implementation

This is the recommended way we would suggest you implement your prebid implementation with our Brid player. It's a combination of a prebid on site with some minor customization on the player level. The main advantage of this implementation is that you don't have to change any present Brid embed codes and the player will work with your already present prebid setup on your page if it exists.

If you plan on using this implementation, you will do all the prebid implementation on your page while sending a single reference to the player.

Example of implementation in Brid CMS under the player settings screen: The main difference here is that you need to tell the player which prebid ad unit (in this case "video-1") you are using on your page.

This is best explained with an example:

var adUnits = [
    {
        code: 'video-1',                                // use this code in the CMS
        mediaTypes: {
            video: {
                playerSize: [640, 480],
                context: 'instream'
            }
        },
        bids: [{
            bidder: 'appnexus',
            params: {
                placementId: 13232361,
                video: {
                    skippable: true,
                    playback_method: ['auto_play_sound_off']
                }
            }
        }]
    }
];

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

pbjs.que.push(function() {
    pbjs.addAdUnits(adUnits);

    pbjs.setConfig({
        cache: {
            url: 'https://prebid.adnxs.com/pbc/v1/cache'
        }
    });

    pbjs.requestBids({
        bidsBackHandler: initAdserver,
        timeout: PREBID_TIMEOUT
    });
});

function initAdserver() {
    if (pbjs.initAdserverSet) return;
    pbjs.initAdserverSet = true;

    console.log('Prebid bids are back', pbjs.getBidResponses());        // bids are back, now we're requesting VAST URL for video unit
    for (var i in adUnits) {                                            // going through adUnits array
        if (adUnits[i].code == 'video-1') {                             // searching for video unit. THIS IS THE AD UNIT YOU NEED TO ENTER IN YOUR BRID PLAYER SETTINGS AREA.
            var vastUrl = pbjs.adServers.dfp.buildVideoUrl({            // generating VAST URL
                adUnit: adUnits[i],
                params: {
                    iu: '/19968336/prebid_cache_video_adunit',
                    cust_params: {
                        section: 'blog',
                        anotherKey: 'anotherValue'
                    },
                    output: 'vast'
                }
            });
            adUnits[i].vastUrl = vastUrl;                               // setting it to adUnits, Brid player will grab it from there
            console.log('Prebid setting vastUrl on page', vastUrl);
        }
    }

    googletag.cmd.push(function() {
        pbjs.que.push(function() {
            pbjs.setTargetingForGPTAsync();
            googletag.pubads().refresh();
        });
    });
}

// in case PBJS doesn't load
setTimeout(function() {
    initAdserver();
}, FAILSAFE_TIMEOUT);

You can also view a complete working example using this implementation HERE
This demo shows how the player can work with both video + display banner header bidding together.


You can override the player size which is sent to prebid by setting the following JavaScript variable on your page:

var prebidPlayerSizeBrid = [640, 480];

By default the player caches bid responses for better performance but you can override this setting by adding the following code to your web page:

var prebidConfigBrid = {useBidCache: false};