Skip to content

Commit

Permalink
GumGum Bid Adapter: Send content url and additional vid params (prebi…
Browse files Browse the repository at this point in the history
…d#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]>
  • Loading branch information
john-ivan and john-bauzon-gumgum authored Feb 20, 2025
1 parent 3ac1ba2 commit 5216f36
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 7 deletions.
25 changes: 22 additions & 3 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,12 @@ function _getVidParams(attributes) {
placement: pt,
plcmt,
protocols = [],
playerSize = []
playerSize = [],
skip,
api,
mimes,
playbackmethod,
playbackend: pbe
} = attributes;
const sizes = parseSizesInput(playerSize);
const [viw, vih] = sizes[0] && sizes[0].split('x');
Expand All @@ -208,12 +213,24 @@ function _getVidParams(attributes) {
pt,
pr,
viw,
vih
vih,
skip,
pbe
};
// Add vplcmt property to the result object if plcmt is available

if (plcmt !== undefined && plcmt !== null) {
result.vplcmt = plcmt;
}
if (api && api.length) {
result.api = api.join(',');
}
if (mimes && mimes.length) {
result.mimes = mimes.join(',');
}
if (playbackmethod && playbackmethod.length) {
result.pbm = playbackmethod.join(',');
}

return result;
}

Expand Down Expand Up @@ -416,6 +433,8 @@ function buildRequests(validBidRequests, bidderRequest) {
}
if (bidderRequest && bidderRequest.ortb2 && bidderRequest.ortb2.site) {
setIrisId(data, bidderRequest.ortb2.site, params);
const curl = bidderRequest.ortb2.site.content?.url;
if (curl) data.curl = curl;
}
if (params.iriscat && typeof params.iriscat === 'string') {
data.iriscat = params.iriscat;
Expand Down
33 changes: 29 additions & 4 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ describe('gumgumAdapter', function () {
segtax: 500,
cids: ['iris_c73g5jq96mwso4d8']
}
}]
}],
url: 'http://pub.com/news',
},
page: 'http://pub.com/news',
ref: 'http://google.com',
Expand Down Expand Up @@ -286,7 +287,11 @@ describe('gumgumAdapter', function () {
const bidRequest = spec.buildRequests([request], bidderRequest)[0];
expect(bidRequest.data).to.have.property('irisid', 'iris_c73g5jq96mwso4d8');
});

it('should set the curl param if present', function() {
const request = { ...bidRequests[0] };
const bidRequest = spec.buildRequests([request], bidderRequest)[0];
expect(bidRequest.data).to.have.property('curl', 'http://pub.com/news');
});
it('should not set the iriscat param when not found', function () {
const request = { ...bidRequests[0] }
const bidRequest = spec.buildRequests([request])[0];
Expand Down Expand Up @@ -517,7 +522,12 @@ describe('gumgumAdapter', function () {
startdelay: 1,
placement: 123456,
plcmt: 3,
protocols: [1, 2]
protocols: [1, 2],
skip: 1,
api: [1, 2],
mimes: ['video/mp4', 'video/webm'],
playbackmethod: [1, 2],
playbackend: 2
};
const request = Object.assign({}, bidRequests[0]);
delete request.params;
Expand All @@ -539,6 +549,11 @@ describe('gumgumAdapter', function () {
expect(bidRequest.data.pr).to.eq(videoVals.protocols.join(','));
expect(bidRequest.data.viw).to.eq(videoVals.playerSize[0].toString());
expect(bidRequest.data.vih).to.eq(videoVals.playerSize[1].toString());
expect(bidRequest.data.skip).to.eq(videoVals.skip);
expect(bidRequest.data.api).to.eq(videoVals.api.join(','));
expect(bidRequest.data.mimes).to.eq(videoVals.mimes.join(','));
expect(bidRequest.data.pbm).to.eq(videoVals.playbackmethod.join(','));
expect(bidRequest.data.pbe).to.eq(videoVals.playbackend);
});
it('should add parameters associated with invideo if invideo request param is found', function () {
const inVideoVals = {
Expand All @@ -550,7 +565,12 @@ describe('gumgumAdapter', function () {
startdelay: 1,
placement: 123456,
plcmt: 3,
protocols: [1, 2]
protocols: [1, 2],
skip: 1,
api: [1, 2],
mimes: ['video/mp4', 'video/webm'],
playbackmethod: [6],
playbackend: 1
};
const request = Object.assign({}, bidRequests[0]);
delete request.params;
Expand All @@ -572,6 +592,11 @@ describe('gumgumAdapter', function () {
expect(bidRequest.data.pr).to.eq(inVideoVals.protocols.join(','));
expect(bidRequest.data.viw).to.eq(inVideoVals.playerSize[0].toString());
expect(bidRequest.data.vih).to.eq(inVideoVals.playerSize[1].toString());
expect(bidRequest.data.skip).to.eq(inVideoVals.skip);
expect(bidRequest.data.api).to.eq(inVideoVals.api.join(','));
expect(bidRequest.data.mimes).to.eq(inVideoVals.mimes.join(','));
expect(bidRequest.data.pbm).to.eq(inVideoVals.playbackmethod.join(','));
expect(bidRequest.data.pbe).to.eq(inVideoVals.playbackend);
});
it('should not add additional parameters depending on params field', function () {
const request = spec.buildRequests(bidRequests)[0];
Expand Down

0 comments on commit 5216f36

Please sign in to comment.