Add Video Support to an Existing Bidder Adapter

This page has instructions for updating your existing bidder adapter with support for video bidding.

When in doubt, use an adapter that already has support for video for reference, such as the AppNexus AST adapter in the Github repo. (The code samples and descriptions below are based on it.)

Step 1. Update your bid params

In order to make sure your adapter supports video, you’ll need to:

  1. Add a video object to your adapter’s bid parameters like the one in the AppNexus AST adapter. To see an example showing how those video params are processed and added to the ad tag, see the AST adapter’s implementation of the callBids function.

  2. Your bidder will have to support returning a VAST URL somewhere in its bid response. Each new bidder adapter added to Prebid.js will have to support its own video URL. For more information, see the implementation of pbjs.buildMasterVideoTagFromAdserverTag.

Step 2. Add video information to the bid response

Once you’ve created the bid response, assuming it’s valid, you must add more video-specific information:

  • Player width
  • Player height

Note that you’ll have to modify the example code below to match the parameters returned by your bidder. We’ve also omitted a lot of error-checking. You can refer to the AppNexus AST adapter implementation for details.

var baseAdapter = require('baseAdapter.js');

// Pull the ad object out of your bidder's response.
var ad = getRtbBid(tag);

// The bid request needs a code to identify the bidder.
bidResponse.bidderCode = 'yourBidder';

// What is the bid price?
bidResponse.cpm = ad.cpm;

// Video-specific information: player width and height, and VAST URL.
bidResponse.width   =;
bidResponse.height  =;
bidResponse.vastUrl =;

Step 3. Add video to the supported media types

Finally, add supportedMediaTypes to the registerBidAdapter() call in your adapter code:

adaptermanager.registerBidAdapter(new XYZBidAdapter, 'xyz', {
  supportedMediaTypes: ['video']
module.exports = XYZBidAdapter;