Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

Price bucket with 0,3$ step - incorrect granularity

Open haroldpussat opened this issue 8 years ago • 2 comments

Type of issue

Question

Description

Hi, We are using prebid 0.34 with a custom price bucket configuration. This price bucket is divided as below

`var customConfigObject = { "buckets" : [{ "precision": 2, "min" : 0.1, "max" : 7, "increment" : 0.02 }, { "precision": 2, "min" : 7, "max" : 10, "increment" : 0.1 }, { "precision": 2, "min" : 10, "max" : 22, "increment" : 0.3 }] };

var pbjs = pbjs || {}; pbjs.que = pbjs.que || [];

pbjs.que.push(function() {
    pbjs.enableSendAllBids();
    pbjs.setPriceGranularity(customConfigObject);
    pbjs.setBidderSequence('random');
});

`

For bids below 10$ CPM, there is no issue and the price bucket is validated. But for bid > 10$ CPM and < 22$ CPM, we are facing price issue. The bid sent to DFP doesn't correspond to the granularity.

Example :

The pbjs debug info indicates that the granularity is well setup : Arguments(1)0: buckets: Array(3)0: {precision: 2, min: 0.1, max: 7, increment: 0.02}1: {precision: 2, min: 7, max: 10, increment: 0.1}2: {precision: 2, min: 10.3, max: 22, increment: 0.3}length: 3__proto__: Array(0)__proto__: Objectcallee: (...)length: 1Symbol(Symbol.iterator): ƒ values()get callee: ƒ ()set callee: ƒ ()__proto__: Object From a test page, I receive from appnexus a bid valued at 12,92$, see the network answer from appnexus

"creative_id": 90355238, "media_type_id": 1, "media_subtype_id": 1, "cpm": 12.92181, "cpm_publisher_currency": 12.92181, "is_bin_price_applied": false, "publisher_currency_code": "$",

My test page send a hb_pb at 12,90$, instead of 13$ or 12,70$. With that difference, my lineItem is not raised because hb_pb doesn't exist at 12,90$. It seems the issue is linked with the 0,3$ granularity. There is no error with pbjs_debug=true, only a warning

prebid.js:3 WARNING: pbjs.setPriceGranularity will be removed in Prebid 1.0. Use pbjs.setConfig({ priceGranularity: }) instead.

I also try to change the min of hte last bucket (change from 10 to 10,3, but still have the issue)

Steps to reproduce

As explained, with a custom bucket configuration and a granularity of 0,3$, the issue is raised.

Test page

If needed I can send you a test page

Expected results

The bucket configuration should be respected from 10$ to 22$ (10$ - 10,3$ - 10,6$ - 10,9$...)

Actual results

Platform details

prebid 0.34 with appnexus, criteo, Smart adapter. I reproduce the issue with Chrome (last stable version - 64)

Other information

haroldpussat avatar Mar 12 '18 21:03 haroldpussat

FYI, issue reproduced with prebid 0.34.4

haroldpussat avatar Mar 13 '18 14:03 haroldpussat

I think the problem is that the step assumption is from 0 instead of the min bucket. Thanks for the report.

mkendall07 avatar Mar 20 '18 22:03 mkendall07