Skip to content

GumGum Bid Adapter: Send content url and additional vid params #12741

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

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
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