Outstream + page prebid implementation
This is the recommended way we would suggest you implement your prebid implementation with our Targetvideo outstream unit. It's a combination of a prebid on site with some minor customization on the outstream unit level.
The main advantage of this implementation is that you don't have to change any present Targetvideo embed codes and the outstream unit 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 Targetvideo outstream unit.
Example of implementation in Targetvideo CMS under the player settings screen
The main difference here is that you need to tell the outstream unit which prebid ad unit (in this case "video-1") you are using on your page.
This is best explained with an example:
<!-- prebid.js -->
<script src="https://acdn.adnxs.com/prebid/not-for-prod/prebid.js" async=true></script>
<!-- <<company>> OUTSTREAM UNIT -->
<script type="text/javascript" src="//<<services_domain>>/player/build/<<outstream_script>>"></script>
<script>
var PREBID_TIMEOUT = 2000;
var FAILSAFE_TIMEOUT = 3000;
var adUnits = [
{
code: 'video-1', // use this code in the CMS
mediaTypes: {
video: {
playerSize: [640, 480],
context: 'outstream'
}
},
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);
</script>
<script type="text/javascript" src="https://services.brid.tv/player/build/brid.outstream.min.js"></script>
<div id="DIV_ID" class="brid" > </div>
<script type="text/javascript"> $bos("DIV_ID", {"id":"UNIT_ID","width":"480","height":"270"}); </script>
TIP
TIP
You can override the outstream unit size which is sent to prebid by setting the following JavaScript variable on your page
**Example:**
var prebidPlayerSize<<company>> = [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 prebidConfig<<company>> = {useBidCache: false};
Updated over 2 years ago