Skip to content

Commit 40b906d

Browse files
authored
kimberliteBidAdapter: video media type support (#11981)
* Kimberlite bid adapter (#1) * initial: bid adapter * styling * Fix: lint (#2) * Fix: lint (#4) * review fixes (#6) * Change: filling request.ext.prebid section (#7) * Video support * Fix: tests * Adapter's version update * No video defaults
1 parent cdd3b5a commit 40b906d

File tree

3 files changed

+191
-73
lines changed

3 files changed

+191
-73
lines changed

modules/kimberliteBidAdapter.js

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { registerBidder } from '../src/adapters/bidderFactory.js';
2-
import { BANNER } from '../src/mediaTypes.js';
2+
import { BANNER, VIDEO } from '../src/mediaTypes.js';
33
import { ortbConverter } from '../libraries/ortbConverter/converter.js'
44
import { deepSetValue } from '../src/utils.js';
5+
import {ORTB_MTYPES} from '../libraries/ortbConverter/processors/mediaType.js';
56

6-
const VERSION = '1.0.0';
7+
const VERSION = '1.1.0';
78

89
const BIDDER_CODE = 'kimberlite';
910
const METHOD = 'POST';
10-
const ENDPOINT_URL = 'https://kimberlite.io/rtb/bid/pbjs';
11+
export const ENDPOINT_URL = 'https://kimberlite.io/rtb/bid/pbjs';
1112

1213
const VERSION_INFO = {
1314
ver: '$prebid.version$',
@@ -16,7 +17,6 @@ const VERSION_INFO = {
1617

1718
const converter = ortbConverter({
1819
context: {
19-
mediaType: BANNER,
2020
netRevenue: true,
2121
ttl: 300
2222
},
@@ -35,18 +35,32 @@ const converter = ortbConverter({
3535
const imp = buildImp(bidRequest, context);
3636
imp.tagid = bidRequest.params.placementId;
3737
return imp;
38-
}
38+
},
39+
40+
bidResponse: function (buildBidResponse, bid, context) {
41+
if (!bid.price) return;
42+
43+
const [type] = Object.keys(context.bidRequest.mediaTypes);
44+
if (Object.values(ORTB_MTYPES).includes(type)) {
45+
context.mediaType = type;
46+
}
47+
48+
const bidResponse = buildBidResponse(bid, context);
49+
return bidResponse;
50+
},
3951
});
4052

4153
export const spec = {
4254
code: BIDDER_CODE,
43-
supportedMediaTypes: [BANNER],
55+
supportedMediaTypes: [BANNER, VIDEO],
4456

4557
isBidRequestValid: (bidRequest = {}) => {
4658
const { params, mediaTypes } = bidRequest;
4759
let isValid = Boolean(params && params.placementId);
4860
if (mediaTypes && mediaTypes[BANNER]) {
4961
isValid = isValid && Boolean(mediaTypes[BANNER].sizes);
62+
} else if (mediaTypes && mediaTypes[VIDEO]) {
63+
isValid = isValid && Boolean(mediaTypes[VIDEO].mimes);
5064
} else {
5165
isValid = false;
5266
}
@@ -58,7 +72,10 @@ export const spec = {
5872
return {
5973
method: METHOD,
6074
url: ENDPOINT_URL,
61-
data: converter.toORTB({ bidderRequest, bidRequests })
75+
data: converter.toORTB({
76+
bidRequests,
77+
bidderRequest
78+
})
6279
}
6380
},
6481

modules/kimberliteBidAdapter.md

+30-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var adUnits = [
2020
code: 'test-div',
2121
mediaTypes: {
2222
banner: {
23-
sizes: [[320, 250], [640, 480]],
23+
sizes: [[320, 250], [640, 480]], // Required.
2424
}
2525
},
2626
bids: [
@@ -34,3 +34,32 @@ var adUnits = [
3434
}
3535
]
3636
```
37+
38+
## Video AdUnit
39+
40+
```javascript
41+
var adUnits = [
42+
{
43+
code: 'test-div',
44+
mediaTypes: {
45+
video: {
46+
// ORTB 2.5 options.
47+
mimes: ['video/mp4'], // Required.
48+
// Other options are optional.
49+
placement: 1,
50+
protocols: [3, 6],
51+
linearity: 1,
52+
startdelay: 0
53+
}
54+
},
55+
bids: [
56+
{
57+
bidder: "kimberlite",
58+
params: {
59+
placementId: 'testVideo'
60+
}
61+
}
62+
]
63+
}
64+
]
65+
```

0 commit comments

Comments
 (0)