Home - Heray/pbjs GitHub Wiki

A. Define your in page ad placements ID: this will be used to identif Sizes: so that

{
            placement_id: 4795910, //REQUIRED- this is placement ID (or specifcy member id +  inventory code)
            placement_sizes: ["300x250", "728x90"], //REQUIRED - size
            placement_targeting: { //OPTIONAL - appnexus targeting params
                age: 30, //OPTIONAL - age
                gender: 'm' //OPTIONAL - gender
            },
            timeout: 1000 //(possibly) REQUIRED - timeout for this bid, if not specified, the callback might never happen if the /jpt call is invalid

        }

B. Define the mapping from your in page placements to pre-bid partners' ad units

{
        "placement_id": 123,
        "bids": [
            {
                "partner_name": "amazon",
                "timeout": 1000,
                "account": "account_name",
                "site": "abc.com",
                "zonesize": "300x250",
                "cpmKeyStr": "pb",
                "keyValueTargeting": {
                    "key1": "value1",
                    "key2": "value2"
                }
            },
            {
                "partner_name": "rubicon",
                "timeout": 1000,
                "account": "10496",
                "site": "44166",
                "zonesize": "191542-57",
                "cpmKeyStr": "pb",
                "keyValueTargeting": {
                    "key1": "value1",
                    "key2": "value2"
                }
            }
        ]
    }

C. Set prebid targeting right before your page sends the impressions to ad server

auctionDetails = prebid.getAuctionDetails();

D. Set a timer to control how long your page would wait for prebid responses before sending the impressions to your ad server.

prebid.callback = function(){
    // Triggers sending impressions to DFP
};

setTimeout(
    function(){
        if(!prebid.callbackExecuted){
             prebid.callback();
        }
    }, prebid.pageTimeout
);

![](http://i.imgur.com/oII0TCr.png =250x)