# Implement Header bidding

OAP Tenants can use Header Bidding for their placements.

Marfeel supports two ad servers out-of-the-box:

  • DFP via Prebid.js
  • Yandex

# Using the Prebid adserver

Always define the ad server type as "Prebid".

The Prebid library in the inventory.json only works with DFP as Adapter.

Schema

Find a description of all the json attributes, and which ones are required, in the Prebid section of the advertisement catalog.

In addition to attributes described in the Prebid schema, the json object can contain:

  • prebidLibrarySrc: a complete URI for the prebid library, if we shouldn't use Marfeel's fork.

# Prebid Implementation examples

# Using Yandex

# Yandex Implementation examples

# Using a Custom ad server

For Tenants that use Header Bidding with dynamic parameters, as this can't be done through inventory.json a custom ad server needs to be created.

  1. Write a Javascript class that extends the Prebid ad server.

The file must be in under src/js/features/adservers/ in the site code repository.

  1. Reference the ad server you created in the inventory.json file.
Open to see the `inventory.json` file
{
    "placements" : {
        "top_web": {
            "adServer": "prebidUamDfpUnit5"
    },
    "adServers" : {
        "prebidUamDfpUnit5" : {
            "type" : "custom",
            "file" : "PrebidUamDfp",
            "slot": "/1234567/example-Unit5",
            "multi-size": "300x250",
            "json": {
                "bidders": [
                    {
                        "bidder": "appnexus",
                        "params": {
                            "placementId": "1234567"
                        },
                        "userId": {
                            "pubcid": "123aa1ad-fbb0-1234-ab13-abce012def",
                            "digitrustid": {
                                "data": {
                                    "id": "",
                                    "version": 2,
                                    "producer": "1A2B3C4D",
                                    "privacy": {
                                        "optout": false
                                    },
                                    "optout": false
                                },
                                "expires": 60
                            },
                            "id5id": "ID1-ABCDE_123455675"
                        },
                        "crumbs": {
                            "pubcid": "123aa1ae-fbb0-1234-ab13-abce012def"
                        }
                    }
                ],
                "uamOptions": {
                    "pubId": "987aa1ad-fbb0-1234-ab13-abce012def",
                    "script": "//c.amazon-adsystem.com/aax2/apstag.js"
                },
                "priceGranularity": {
                    "buckets": [{
                        "precision": 2,
                        "min": 0,
                        "max": 8,
                        "increment": 0.01
                    }, {
                        "precision": 2,
                        "min": 8,
                        "max": 16,
                        "increment": 0.10
                    }]
                }
            }
        }
    }
  }
}
  1. Implement buildBidderSettings method that performs the dynamic changes to the ad server configuration.

# Example of a custom ad server with Header Bidding implementation