Get Started with Prebid Server

This page has instructions for adding Prebid Server to Prebid.js.

For many publishers, client-side header bidding is a balancing act between the inclusion of demand partners and impact to the page.

Using Prebid Server, you can move demand partners server-side, eliminating most of the latency impact that comes with adding more partners.

This should help you make more money without sacrificing user experience.

Prebid Server is open source!
Prebid Server is an open source project. The source code is hosted under the Prebid organization on Github.

Step 1. Choose Your Server Host

  • If you plan to host Prebid Server on your own server, please skip to Step 2 below. If you do not have your own server, please choose from one of the members below to get started.

  • AppNexus
    • Go to the Prebid Server sign-up page and click the button to sign up.
    • Fill out the form details, including your email address.
    • When approved, you will receive an email with your assigned accountId. You will need this for configuring Prebid.js to use Prebid Server.
  • Rubicon Project
    • Please send an email to and proceed to Step 2 below. You do not have to wait for a verification email to get started.

Step 2. Download Prebid.js with Prebid Server enabled

  • Go to the download page, select all the demand adapters you want to work with, and include “Prebid Server”.

  • For example, if you want to use AppNexus, Index Exchange, and Rubicon with Prebid Server, select:
    • AppNexus
    • Index Exchange
    • Rubicon
    • Prebid Server
  • Then, click Get Custom Prebid.js and follow the instructions.

Step 3. Update your site with the new build of Prebid.js

Update your site’s hosted copy of Prebid.js to use the new build you just generated. (For example, you may host your copy on your site’s servers or using a CDN such as Fastly or Akamai.)

Step 4. Configure S2S bidder adapters

The Prebid Server settings (defined by the pbjs.setConfig method) go in the same anonymous function where you define your ad units. This method must be called before pbjs.requestBids.

The code in your Prebid configuration block should look something like the following (unless you want to show video ads, in which case see Using Prebid Server to show video ads below).

See The s2sConfig object for definitions of the keys in the s2sConfig object.

var pbjs = pbjs || {};

pbjs.que.push(function() {

        s2sConfig: {
            accountId: '1',
            enabled: true,
            bidders: ['appnexus', 'pubmatic'],
            timeout: 1000,
            adapter: 'prebidServer',
            endpoint: ''
            syncEndpoint: ''
            cookieSet: true,
            cookiesetUrl: ''

    var adUnits = [{
        code: '/19968336/header-bid-tag-1',
        sizes: sizes,
        bids: [{
            /* Etc. */

Additional cookieSet details
We recommend that users leave cookieSet enabled since it’s essential for server-to-server header bidding that we have a persistent cookie for improved cookie match rates. If set to false:
• Prebid.js will not overwrite all links on page to redirect through a persistent cookie URL
• Prebid.js will not display a footer message on Safari indicating that cookies will be placed on browsers that block 3rd party cookies

Using Prebid Server to show video ads

If you are using Prebid Server and you want to show video ads, you must use OpenRTB video parameters in your Prebid ad unit as shown below.

The mimes parameter is required by OpenRTB. For all other parameters, check with your server-side header bidding partner.

var adUnit1 = {
    code: 'videoAdUnit',
    mediaTypes: {
        video: {
            context: "instream",
            mimes: ['video/mp4'],
            playerSize: [400, 600],
            minduration: 1,
            maxduration: 2,
            protocols: [1, 2],
            w: 1,
            h: 2,
            startdelay: 1,
            placement: 1,
            playbackmethod: [2]
            // other OpenRTB video params
    bids: [
        // ...