0

We have our Price Granularity for Prebid set to high. However, since it's capped at $20, if we get a bid for $30 or $40 we're unable to accept it.

How can we stick with Price Granularity high with Prebid, but in instances we have a bid north of $20, automatically round down to $20 so that we can accept the bid.

Thank you..

ELB Today
  • 9
  • 2

2 Answers2

1

According to Prebid documentation is should already be rounded down, but you can explicitly control it by adding the following code.

Assuming you're using the standard Prebid targeting keys

pbjs.bidderSettings.standard = {
        adserverTargeting: [{
                key: 'hb_bidder',
                val: function val(bidResponse) {
                        return bidResponse.bidderCode;
                }
        }, {
                key: 'hb_adid',
                val: function val(bidResponse) {
                        return bidResponse.adId;
                }
        }, {
                key: 'hb_pb',
                val: function val(bidResponse) {
                        var cpm = bidResponse.cpm;
                        if (cpm > 20.00) {
                                return 20.00;
                        }
                        return (Math.floor(cpm * 100) / 100).toFixed(2);
                }
        }]
};

Add this after pbjs.addAdUnits( ad_units )

Mitesh
  • 433
  • 1
  • 5
  • 6
0

You’ll want to use the custom setting instead of using high to get what you want

See an example here: http://prebid.org/dev-docs/publisher-api-reference.html#customCPMObject

For the JSON youll want to redefine the same granularity settings for high in that JSON object and then add upon it to get additional granularity > $20.

Pro tips:

  • if you do not define values between $0-$x.xx that can act as a floor if you never want bids lower than x going to DFP
  • DFP caps the number of line items in an order at 450, so you may need an additional order(s) for your new granularity
    • always overlap the settings. Eg. Bucket 1 = $0-$3.00. Bucket 2 should start at $3.00-x (if you dont, a $3.009 bid wont be passed in to DFP
Andrew Bowman
  • 798
  • 9
  • 21