Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db38cc5

Browse files
author
Rich Loveland
committed
RAD-1229 add docs for Custom CPM Bucket Sizing
(From 0.14 release)
1 parent 5cd4ce5 commit db38cc5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

dev-docs/publisher-api-reference.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ Accepted values:
365365
+ `"high"`: $0.01 increments, capped at $20 CPM
366366
+ `"auto"`: Applies a sliding scale to determine granularity as shown in the [Auto Granularity](#autoGranularityBucket) table below.
367367
+ `"dense"`: Like `"auto"`, but the bid price granularity uses smaller increments, especially at lower CPMs. For details, see the [Dense Granularity](#denseGranularityBucket) table below.
368+
+ `customConfigObject`: If you pass in a custom config object (as shown in the [Custom CPM Bucket Sizing](#customCPMObject) example below), you can have much finer control over CPM bucket sizes, precision, and caps.
368369

369370
<div class="alert alert-danger" role="alert">
370371
<p>
@@ -396,6 +397,37 @@ Accepted values:
396397
| CPM <= $20 and >$8 | $0.50 increments | $14.26 floored to $14.00 |
397398
| CPM > $20 | Caps the price bucket at $20 | $24.82 floored to $20.00 |
398399

400+
<a name="customCPMObject"></a>
401+
402+
#### Custom CPM Bucket Sizing
403+
404+
To set up your own custom CPM buckets, create an object like the following, and pass it into `setPriceGranularity`:
405+
406+
```javascript
407+
const customConfigObject = {
408+
"buckets" : [{
409+
"precision" 2, //default is 2 if omitted - means 2.1234 rounded to 2 decimal places = 2.12
410+
"min" : 0,
411+
"max" : 5,
412+
"increment" : 0.01,
413+
},
414+
{
415+
"precision" 2,
416+
"min" : 5,
417+
"max" : 8,
418+
"increment" : 0.05,
419+
},
420+
{
421+
"precision" 2,
422+
"min" : 8,
423+
"max" : 20,
424+
"increment" : 0.5
425+
}]
426+
};
427+
428+
//set custom config object
429+
pbjs.setPriceGranularity(customConfigObject);
430+
```
399431

400432
<hr class="full-rule">
401433

0 commit comments

Comments
 (0)