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

GumGum Bid Adapter: Support for cids #11713

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
30 changes: 24 additions & 6 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,12 @@
data.fp = floor;
data.fpc = currency;
}

if (bidderRequest && bidderRequest.ortb2 && bidderRequest.ortb2.site) {
setIrisId(data, bidderRequest.ortb2.site, params);
}
if (params.iriscat && typeof params.iriscat === 'string') {
data.iriscat = params.iriscat;
}

if (params.irisid && typeof params.irisid === 'string') {
data.irisid = params.irisid;
}

if (params.zone || params.pubId) {
params.zone ? (data.t = params.zone) : (data.pubId = params.pubId);

Expand Down Expand Up @@ -447,6 +444,27 @@
});
return bids;
}
export function getCids(site) {
if (site.content && Array.isArray(site.content.data)) {
for (const dataItem of site.content.data) {
if (dataItem.name.includes('iris.com') || dataItem.name.includes('iris.tv')) {
Dismissed Show dismissed Hide dismissed
return dataItem.ext.cids.join(',');
}
}
}
return null;
}
export function setIrisId(data, site, params) {
let irisID = getCids(site);
if (irisID) {
data.irisid = irisID;
} else {
// Just adding this chechk for safty and if needed we can remove
if (params.irisid && typeof params.irisid === 'string') {
data.irisid = params.irisid;
}
}
}

function handleLegacyParams(params, sizes) {
const data = {};
Expand Down
34 changes: 27 additions & 7 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,28 @@ describe('gumgumAdapter', function () {

describe('buildRequests', function () {
let sizesArray = [[300, 250], [300, 600]];
const bidderRequest = {
ortb2: {
site: {
content: {
data: [{
name: 'www.iris.com',
ext: {
segtax: 500,
cids: ['iris_c73g5jq96mwso4d8']
}
}]
},
page: 'http://pub.com/news',
ref: 'http://google.com',
publisher: {
id: 'p10000',
domain: 'pub.com'
}
}
}
};

let bidRequests = [
{
gppString: 'DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN',
Expand Down Expand Up @@ -259,19 +281,17 @@ describe('gumgumAdapter', function () {
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.have.property('iriscat');
});
it('should set the irisid param when found iris_c73g5jq96mwso4d8', function() {
const request = { ...bidRequests[0], params: { irisid: 'abc123' } };
const bidRequest = spec.buildRequests([request], bidderRequest)[0];
expect(bidRequest.data).to.have.property('irisid', 'iris_c73g5jq96mwso4d8');
});

it('should not set the iriscat param when not found', function () {
const request = { ...bidRequests[0] }
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.not.have.property('iriscat');
});

it('should set the irisid param when found', function () {
const request = { ...bidRequests[0], params: { irisid: 'abc123' } }
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.have.property('irisid');
});

it('should not set the irisid param when not found', function () {
const request = { ...bidRequests[0] }
const bidRequest = spec.buildRequests([request])[0];
Expand Down