Getting Started with Video for Prebid.js

If you’re new to header bidding and Prebid, your implementation of Prebid for video demand will likely go much smoother if you first read the following:

See Prebid.js Video Overview for a general description and high-level overview of working with video demand in Prebid.js.

Ad Ops

Ad Server Setup

Start by reading AdOps Getting Started. This will give you a general overview of setting up your price buckets and line items on your ad server.

One thing to keep in mind as you set up your line items is price granularity. Be sure to communicate your price granularity requirements to your developers, as they might need to define custom configuration settings, depending on your granularity.


If you already have a Prebid integration for banner, you must create a separate set of ad server line items to enable Prebid to monetize instream video.

If you’re using Google Ad Manager as your ad server: Once you understand the general setup requirements, follow the instructions for video-specific line item setup in Setting Up Prebid Video in Google Ad Manager.

If you’re using another ad server: Follow the instructions for your ad server to create line items for instream video content. The primary points to keep in mind as you set up your line items include: • Line items must target Prebid key-values. • The VAST creative URL must be in the format{hb_cache_id}, where {hb_cache_id} is the value passed to the ad server from Prebid.js.


If you already have a Prebid integration for banner, you don’t need to do anything differently for outstream video. Outstream units use the same creative and line item targeting setup as banner creatives. See the Step by Step Guide to Google Ad Manager Setup for instructions. (If you’re not using Google Ad Manager as your ad server, follow your ad server’s guidelines for setting up your line items.)

Prebid Server If you’ve decided to conduct your header bidding auctions server-side rather than on the client, you need to have a Prebid Server account or set up your own. See the Prebid Server Overview to begin your integration.


Download Prebid.js

Your first step to implementing header bidding for video is to download Prebid.js. Before downloading, select the adapters you want to include. (You can add more adapters later.)

  • Include at least one video adapter. Find a list of available video adapters here.
  • If Google Ad Manager is your ad server, you must include the Google Ad Manager Video module.
  • If you’ll be integrating with Prebid Server, be sure to include “Prebid Server” in the list of adapters.

Define Prebid Ad Units

Setting up Prebid ad units is almost the same whether you’re working with instream video ads or outstream. The primary difference is specifying the type of video ad (instream or outstream), which you do in the field:

    var adUnit1 = {
        code: 'videoAdUnit',
        mediaTypes: {
            video: {
                context: 'instream', //or 'outstream'
                playerSize: [640, 480],
                mimes: ['video/mp4'],    // required for Prebid Server
                protocols: [1, 2, 3, 4, 5, 6, 7, 8],
                playbackmethod: [2],
                skip: 1

The field is where you define the player size that will be passed to demand partners.

Prebid Server

If you’re using Prebid Server, you must also include the field, as this is required by OpenRTB.

In your ad unit you also need to define your list of bidders. For example, including AppNexus as a bidder would look something like this:

    var adUnit1 = {
        bids: [{
            bidder: 'appnexus',
            params: {
                placementId: '123456789',

The parameters differ depending on which bidder you’re including. For a list of parameters for each bidder, see Bidders’ Params.

For full details on creating instream video ad units, see Show Video Ads with Google Ad Manager – Create Ad Unit.

For full details on creating outstream video ad units, see Show Outstream Video Ads – Create Ad Unit.


After you’ve defined your ad units, you can continue with the rest of your configuration. In most cases for video, the first step will be to define where the VAST XML coming back in the bids will be stored. Some bidders have you covered here – the VAST is stored on their servers. But many bidders don’t have their own server-side cache.

Video players expect that the response from the ad server will be a URL that points to somewhere on the internet that stores the video ad creative. This URL can’t point to the browser, so Prebid.js will send bid VAST XML out to a cache so it can be displayed if it wins in the ad server.

Configuring the video cache is done with setConfig:

        cache: {
            url: ''
            /* Or whatever your preferred video cache URL is */

And this is where setups for instream and outstream diverge. Please follow one of these links:

Be sure to note the setting for price granularity. You might need to set up a custom price granularity. (See “Custom CPM Bucket Sizing” under Price Granularity. Or, if you’re monetizing both banner and video inventory with Prebid, you might need to define format-specific price granularity settings through mediaTypePriceGranularity.

Prebid Server If you’re using Prebid Server, you also need to configure your server-to-server bidder adapters. See Getting Started with Prebid Server.


This section contains working examples of instream and outstream video ads for various players.

Using client-side adapters



Using Prebid Server

Further Reading