Customize certain advertising aspects

Fine tune advertisment behavior, loading and timeouts

Set frequency cap for ads

Use the following code snippet to set a custom ad frequency setting on a per user level in a Brid outstream unit. The setting expects an Integer which holds a value in hours to how long a user will need to wait until it gets another ad served. In the example below, the value is set to 5 which means that a viewer will get an ad served only once every 5 hours.

Example:

$bos("myDiv", {
	"id":"UNIT_ID",
	"width":"640",
	"height":"480",
	"freqCap": 5
});

Custom ad tag parameters

Adding a custom ad tag parameters you can fine tune advertising behavior.

Force specific ad parser

You can force what ad parser you want the outstream unit to use per ad tag by adding the following parameter to your ad tag like this:

Example:

//Append to the ad tag URL
&brid_parser=ima
//Append to the ad tag URL
&brid_parser=brid

Force insecure mode for VPAID ads

Certain VPAID ads need to be pushed through an insecure (friendly) iframe when served through Google IMA SDK to display properly. You can force this insecure mode by adding the following string to your ad tag URL call.

🚧

Warrning

Available only when using Google IMA SDK.

Example:

//Append to the ad tag URL
&brid_vpaidmode=insecure

Custom Ad timeout

You can change the default timeout the outstream unit has for ad tags by adding the following param to the end of your ad tag URL.

πŸ“˜

Note

By default this timeout is set to 15 seconds.

Example:

//Append to the ad tag URL
&brid_adtimeout=20

By adding the above to your ad tag, you will tell the outstream unit to wait for 20 seconds before it considers a timeout for this ad tag.

Load custom code once the outstream ad has completed playback

The following code example shows how you can hook onto the ouststream unit AdEnd event and execute custom code

Example:

function do_on_error(){
    console.log('error fired do custom code');
    //Add custom code here
}

function do_on_adend(){
    console.log('ad end fired do custom code');
    //Add custom code here
}

$bos("myDiv", configObj,  function(){
    // adEnd fires each time an ad ends (even if it errors out or doesn't exist)
    this.on('adEnd', do_on_adend);
    // adError fires only if an ad errors out, this includes empty VAST responses
    this.on('adError', do_on_error);
});
$bp("myDiv", configObj);
$bp().on("adEnd", function(){
    //Remove player and all dependencies
    $bp().destroy();
    console.log('ad end fired removing player');
    //Add custom code here
});
$bp().on("adError", function(){
    //Remove player and all dependencies
    $bp().destroy();
    console.log('error fired removing player');
    //Add custom code here
});

Set a custom ad with the API

Use the code snippet below to instruct the outstream unit to use a custom ad. In the demo below we set a custom ad tag URL as the source of the ad (URL returns a valid VAST template) and set it to appear as a mid-roll on the 20th second of the video.

Example:

var Ad = {
        /**
        * Mobile will be called on mobile and desktop if desktop is empty. 
        * If the desktop property is populated, the ad tags under mobile will get called on mobile only.
        */
        "mobile": [adtag1, adtag2, adtag3], 
        // Will get called in succession on desktop
        "desktop": [adtag1, adtag2, adtag3],
        // Type 0 for pre roll,1 Midroll, 2 Postroll
        "adType": "1", 
        //Used for midrolls, can se s=seconds, i=interval, %=percentage of the video
  	    "adTimeType": "s",
        //Cuepoints where you want the midroll to occur, if multiple, comma separated.
        "cuepoints": "20, 30" 
    }
    function foo() {
        $bos('OUTSTREAM_UNIT_DIV_ID').setAd(Ad);
    }
$bos("OUTSTREAM_UNIT_DIV_ID", {"id":"UNIT_ID","width":"480","height":"270",
 "Ad": [
        {
            /**
             * Mobile will be called on both mobile and desktop if desktop is left empty or omitted 
             * If desktop property is populated, 
             * the ad tags under mobile will get called on mobile only
             * and desktop on desktop only.
             */
            "mobile": [adtag1, adtag2, adtag3], 
            // Will get called in succession on desktop
            "desktop": [adtag1, adtag2, adtag3],
            // Type 0 for pre roll
          	"adType": "0", 
        }
    ]
});
$bos("OUTSTREAM_UNIT_DIV_ID", {"id":"UNIT_ID","width":"640","height":"360",
 "Ad": [
        {
          	//Will get called in succession on both mobile and desktop if the desktop array is left empty or omitted.
            "mobile": [mobile_adtag1, mobile_adtag2], 
          	// Will get called in succession on desktop only
            "desktop": [desktop_adtag1, desktop_adtag2], 
            "adType": "0", // Type 0 for pre roll
        }
    ]
});

Valid paramaters when setting an ad can be found here

Reset ad frequency counter on page refresh

You can use the following parameter resetFreqCounter: bool to force a outstream unit to reset its ad frequency counter on every page refresh.

Example:

$bp("myDiv", {
	"id":"UNIT_ID",
	"width":"640",
	"height":"360",
	"video":"VIDEO_ID",
	"resetFreqCounter": true
});

Customize Prebid timeouts

Timeout for prebid

See the below example on how to set a custom timeout in ms for how long prebid should wait on a response from a bidder.

πŸ“˜

Note

Default setting is 2000ms.

Example:

$bos("myDiv", {
	"id":"UNIT_ID",
	"width":"640",
	"height":"360",
	"prebid_timeout": 2500 //2.5 seconds
});

Amazon prebid

See the below example on how to set a custom timeout in ms for how long Amazon prebid should wait on a response.

πŸ“˜

Note

Default setting is 3 seconds.

Example:

$bos("myDiv", {
	"id":"UNIT_ID",
	"width":"640",
	"height":"360",
	"a9_timeout": 2500
});