Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Criteo Bid Adapter : add missing video fields #10720

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {

if (hasVideoMediaType(bidRequest)) {
const video = {
context: bidRequest.mediaTypes.video.context,
playersizes: parseSizes(deepAccess(bidRequest, 'mediaTypes.video.playerSize'), parseSize),
mimes: bidRequest.mediaTypes.video.mimes,
protocols: bidRequest.mediaTypes.video.protocols,
Expand All @@ -556,7 +557,19 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
minduration: bidRequest.mediaTypes.video.minduration,
playbackmethod: bidRequest.mediaTypes.video.playbackmethod,
startdelay: bidRequest.mediaTypes.video.startdelay,
plcmt: bidRequest.mediaTypes.video.plcmt
plcmt: bidRequest.mediaTypes.video.plcmt,
w: bidRequest.mediaTypes.video.w,
h: bidRequest.mediaTypes.video.h,
linearity: bidRequest.mediaTypes.video.linearity,
skipmin: bidRequest.mediaTypes.video.skipmin,
skipafter: bidRequest.mediaTypes.video.skipafter,
minbitrate: bidRequest.mediaTypes.video.minbitrate,
maxbitrate: bidRequest.mediaTypes.video.maxbitrate,
delivery: bidRequest.mediaTypes.video.delivery,
pos: bidRequest.mediaTypes.video.pos,
playbackend: bidRequest.mediaTypes.video.playbackend,
adPodDurationSec: bidRequest.mediaTypes.video.adPodDurationSec,
durationRangeSec: bidRequest.mediaTypes.video.durationRangeSec,
};
const paramsVideo = bidRequest.params.video;
if (paramsVideo !== undefined) {
Expand Down
28 changes: 27 additions & 1 deletion test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1326,12 +1326,25 @@ describe('The Criteo bidding adapter', function () {
sizes: [[640, 480]],
mediaTypes: {
video: {
context: 'instream',
playerSize: [640, 480],
mimes: ['video/mp4', 'video/x-flv'],
maxduration: 30,
api: [1, 2],
protocols: [2, 3],
plcmt: 3
plcmt: 3,
w: 640,
h: 480,
linearity: 1,
skipmin: 30,
skipafter: 30,
minbitrate: 10000,
maxbitrate: 48000,
delivery: [1, 2, 3],
pos: 1,
playbackend: 1,
adPodDurationSec: 30,
durationRangeSec: [1, 30],
}
},
params: {
Expand All @@ -1350,6 +1363,7 @@ describe('The Criteo bidding adapter', function () {
expect(request.url).to.match(/^https:\/\/bidder\.criteo\.com\/cdb\?profileId=207&av=\d+&wv=[^&]+&cb=\d/);
expect(request.method).to.equal('POST');
const ortbRequest = request.data;
expect(ortbRequest.slots[0].video.context).to.equal('instream');
expect(ortbRequest.slots[0].video.mimes).to.deep.equal(['video/mp4', 'video/x-flv']);
expect(ortbRequest.slots[0].sizes).to.deep.equal([]);
expect(ortbRequest.slots[0].video.playersizes).to.deep.equal(['640x480']);
Expand All @@ -1362,6 +1376,18 @@ describe('The Criteo bidding adapter', function () {
expect(ortbRequest.slots[0].video.playbackmethod).to.deep.equal([1, 3]);
expect(ortbRequest.slots[0].video.placement).to.equal(2);
expect(ortbRequest.slots[0].video.plcmt).to.equal(3);
expect(ortbRequest.slots[0].video.w).to.equal(640);
expect(ortbRequest.slots[0].video.h).to.equal(480);
expect(ortbRequest.slots[0].video.linearity).to.equal(1);
expect(ortbRequest.slots[0].video.skipmin).to.equal(30);
expect(ortbRequest.slots[0].video.skipafter).to.equal(30);
expect(ortbRequest.slots[0].video.minbitrate).to.equal(10000);
expect(ortbRequest.slots[0].video.maxbitrate).to.equal(48000);
expect(ortbRequest.slots[0].video.delivery).to.deep.equal([1, 2, 3]);
expect(ortbRequest.slots[0].video.pos).to.equal(1);
expect(ortbRequest.slots[0].video.playbackend).to.equal(1);
expect(ortbRequest.slots[0].video.adPodDurationSec).to.equal(30);
expect(ortbRequest.slots[0].video.durationRangeSec).to.deep.equal([1, 30]);
});

it('should properly build a video request with more than one player size', function () {
Expand Down