Skip to content

Commit 9f90e1e

Browse files
john-ivanjohn-bauzon-gumgum
authored andcommitted
GumGum Bid Adapter: Send content url and additional vid params (prebid#12741)
* ADTS-530-send-content-url-from-prebid-adapter-to-hbid-endpoint * added tests for new params and converted array params to strings * changed comment for rebuild * added support for playbackmethod for video ads * added support for playbackend * modified curl to only be added if present --------- Co-authored-by: John Bauzon <[email protected]>
1 parent 7bc63a7 commit 9f90e1e

File tree

2 files changed

+51
-7
lines changed

2 files changed

+51
-7
lines changed

modules/gumgumBidAdapter.js

+22-3
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,12 @@ function _getVidParams(attributes) {
190190
placement: pt,
191191
plcmt,
192192
protocols = [],
193-
playerSize = []
193+
playerSize = [],
194+
skip,
195+
api,
196+
mimes,
197+
playbackmethod,
198+
playbackend: pbe
194199
} = attributes;
195200
const sizes = parseSizesInput(playerSize);
196201
const [viw, vih] = sizes[0] && sizes[0].split('x');
@@ -208,12 +213,24 @@ function _getVidParams(attributes) {
208213
pt,
209214
pr,
210215
viw,
211-
vih
216+
vih,
217+
skip,
218+
pbe
212219
};
213-
// Add vplcmt property to the result object if plcmt is available
220+
214221
if (plcmt !== undefined && plcmt !== null) {
215222
result.vplcmt = plcmt;
216223
}
224+
if (api && api.length) {
225+
result.api = api.join(',');
226+
}
227+
if (mimes && mimes.length) {
228+
result.mimes = mimes.join(',');
229+
}
230+
if (playbackmethod && playbackmethod.length) {
231+
result.pbm = playbackmethod.join(',');
232+
}
233+
217234
return result;
218235
}
219236

@@ -416,6 +433,8 @@ function buildRequests(validBidRequests, bidderRequest) {
416433
}
417434
if (bidderRequest && bidderRequest.ortb2 && bidderRequest.ortb2.site) {
418435
setIrisId(data, bidderRequest.ortb2.site, params);
436+
const curl = bidderRequest.ortb2.site.content?.url;
437+
if (curl) data.curl = curl;
419438
}
420439
if (params.iriscat && typeof params.iriscat === 'string') {
421440
data.iriscat = params.iriscat;

test/spec/modules/gumgumBidAdapter_spec.js

+29-4
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ describe('gumgumAdapter', function () {
110110
segtax: 500,
111111
cids: ['iris_c73g5jq96mwso4d8']
112112
}
113-
}]
113+
}],
114+
url: 'http://pub.com/news',
114115
},
115116
page: 'http://pub.com/news',
116117
ref: 'http://google.com',
@@ -286,7 +287,11 @@ describe('gumgumAdapter', function () {
286287
const bidRequest = spec.buildRequests([request], bidderRequest)[0];
287288
expect(bidRequest.data).to.have.property('irisid', 'iris_c73g5jq96mwso4d8');
288289
});
289-
290+
it('should set the curl param if present', function() {
291+
const request = { ...bidRequests[0] };
292+
const bidRequest = spec.buildRequests([request], bidderRequest)[0];
293+
expect(bidRequest.data).to.have.property('curl', 'http://pub.com/news');
294+
});
290295
it('should not set the iriscat param when not found', function () {
291296
const request = { ...bidRequests[0] }
292297
const bidRequest = spec.buildRequests([request])[0];
@@ -517,7 +522,12 @@ describe('gumgumAdapter', function () {
517522
startdelay: 1,
518523
placement: 123456,
519524
plcmt: 3,
520-
protocols: [1, 2]
525+
protocols: [1, 2],
526+
skip: 1,
527+
api: [1, 2],
528+
mimes: ['video/mp4', 'video/webm'],
529+
playbackmethod: [1, 2],
530+
playbackend: 2
521531
};
522532
const request = Object.assign({}, bidRequests[0]);
523533
delete request.params;
@@ -539,6 +549,11 @@ describe('gumgumAdapter', function () {
539549
expect(bidRequest.data.pr).to.eq(videoVals.protocols.join(','));
540550
expect(bidRequest.data.viw).to.eq(videoVals.playerSize[0].toString());
541551
expect(bidRequest.data.vih).to.eq(videoVals.playerSize[1].toString());
552+
expect(bidRequest.data.skip).to.eq(videoVals.skip);
553+
expect(bidRequest.data.api).to.eq(videoVals.api.join(','));
554+
expect(bidRequest.data.mimes).to.eq(videoVals.mimes.join(','));
555+
expect(bidRequest.data.pbm).to.eq(videoVals.playbackmethod.join(','));
556+
expect(bidRequest.data.pbe).to.eq(videoVals.playbackend);
542557
});
543558
it('should add parameters associated with invideo if invideo request param is found', function () {
544559
const inVideoVals = {
@@ -550,7 +565,12 @@ describe('gumgumAdapter', function () {
550565
startdelay: 1,
551566
placement: 123456,
552567
plcmt: 3,
553-
protocols: [1, 2]
568+
protocols: [1, 2],
569+
skip: 1,
570+
api: [1, 2],
571+
mimes: ['video/mp4', 'video/webm'],
572+
playbackmethod: [6],
573+
playbackend: 1
554574
};
555575
const request = Object.assign({}, bidRequests[0]);
556576
delete request.params;
@@ -572,6 +592,11 @@ describe('gumgumAdapter', function () {
572592
expect(bidRequest.data.pr).to.eq(inVideoVals.protocols.join(','));
573593
expect(bidRequest.data.viw).to.eq(inVideoVals.playerSize[0].toString());
574594
expect(bidRequest.data.vih).to.eq(inVideoVals.playerSize[1].toString());
595+
expect(bidRequest.data.skip).to.eq(inVideoVals.skip);
596+
expect(bidRequest.data.api).to.eq(inVideoVals.api.join(','));
597+
expect(bidRequest.data.mimes).to.eq(inVideoVals.mimes.join(','));
598+
expect(bidRequest.data.pbm).to.eq(inVideoVals.playbackmethod.join(','));
599+
expect(bidRequest.data.pbe).to.eq(inVideoVals.playbackend);
575600
});
576601
it('should not add additional parameters depending on params field', function () {
577602
const request = spec.buildRequests(bidRequests)[0];

0 commit comments

Comments
 (0)