Server to Server Configuration
Prebid provides a server-side solution to header bidding. This solution can be hosted or custom and help reduce latency between bid request and ad selection and improve performance of the publishers ad presentation.
					
pbjs.setConfig({
    s2sConfig: {
        accountId: '1',
        bidders: ['appnexus', 'pubmatic'],
        defaultVendor: 'appnexus',
        timeout: 1000,
        adapterOptions: {
            pubmatic: { key: 'value' },
            appnexus: { key: 'value' }
        },
        syncUrlModifier: {
            'openx': function(type, url, bidder) {
            const publisherId = '00000123231231'
            url += `andri=${publisherId}`;

            return url
            }
        }
    }
})
					
				
Arguments:
  • s2sconfig: object

    The configuration object for server to server header bidding.

    Accepted Values
    Attribute Scope Type Description
    accountId Required String String representing the publisher's Prebid Server Account Id.
    bidders Required Array of Strings An array of strings representing the selected server side bidders.
    defaultVendor Optional String Automatically includes all following options in the config with vendor’s default values. Individual properties can be overridden by including them in the config along with this setting. See the Additional Notes below for more information.
    enabled Optional Boolean Enables S2S - defaults to false.
    timeout Required Integer Number of milliseconds allowed for the server-side auctions. This should be approximately 200ms-300ms less than your Prebid.js timeout to allow for all bids to be returned in a timely manner. See the Additional Notes below for more information.
    adapter Required String Adapter code for S2S. Defaults to ‘prebidServer’.
    endpoint Required URL Defines the auction endpoint for the Prebid Server cluster.
    syncEndpoint Required URL Defines the cookie_sync endpoint for the Prebid Server cluster.
    userSyncLimit Optional Integer Max number of userSync URLs that can be executed by Prebid Server cookie_sync per request. If not defined, PBS will execute all userSync URLs included in the request.
    adapterOptions Optional Object Arguments will be added to resulting OpenRTB payload to Prebid Server in request.ext.BIDDER. See the example above.
    extPrebid Optional Object Arguments will be added to resulting OpenRTB payload to Prebid Server in request.ext.prebid. See video-related example below.
    syncUrlModifier Optional Object Function to modify a bidder’s sync url before the actual call to the sync endpoint. Bidder must be enabled for s2sConfig.
Default Vendors
Currently supported vendors are Appnexus and Rubicon.
When using defaultVendor option, accountId and bidders properties still need to be defined.
Timeout
If the s2sConfig timeout is greater than the Prebid.js timeout, the s2sConfig timeout will be automatically adjusted to 75% of the Prebid.js timeout in order to fit within the auction process.
Video via s2sConfig
Supporting video through the Server-to-Server route can be done by providing a couple of extra arguments on the extPrebid object.
						
pbjs.setConfig({
    s2sConfig: {
        accountId: '1001',
        bidders: ['rubicon', 'pubmatic'],
        defaultVendor: 'rubicon',
        timeout: 250,
        extPrebid: {
            cache: {
                vastxml: { returnCreative: false }
            },
            targeting: {
                pricegranularity: {"ranges": [{"max":40.00,"increment":1.00}]}
            }
        }
    }
})						
					
Additional options for s2sConfig may be enabled by including the Server-to-Server testing module.
Response
Response Description
{ response: example }
  • param1: string

    String indicating some value that has to be passed as a string type.

  • param2: number

    Number indicating some value that has to be passed as a number type.

    Note: This number should be between 0 and infinity.