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

IX Bid Adapter: Add support for ID5, Lotame Panorama ID, Epsilon Publisher Link, Audigent Halo ID, SharedID #7809

Merged
merged 3 commits into from
Dec 15, 2021
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
22 changes: 16 additions & 6 deletions modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ const SOURCE_RTI_MAPPING = {
'neustar.biz': 'fabrickId',
'zeotap.com': 'zeotapIdPlus',
'uidapi.com': 'UID2',
'adserver.org': 'TDID'
'adserver.org': 'TDID',
'id5-sync.com': '', // ID5 Universal ID, configured as id5Id
'crwdcntrl.net': '', // Lotame Panorama ID, lotamePanoramaId
'epsilon.com': '', // Publisher Link, publinkId
'audigent.com': '', // Halo ID from Audigent, haloId
'pubcid.org': '' // SharedID, pubcid
};
const PROVIDERS = [
'britepoolid',
Expand All @@ -69,7 +74,8 @@ const PROVIDERS = [
'quantcastId',
'pubcid',
'TDID',
'flocId'
'flocId',
'pubProvidedId'
];
const REQUIRED_VIDEO_PARAMS = ['mimes', 'minduration', 'maxduration']; // note: protocol/protocols is also reqd
const VIDEO_PARAMS_ALLOW_LIST = [
Expand Down Expand Up @@ -444,16 +450,19 @@ function getEidInfo(allEids, flocData) {
let seenSources = {};
if (isArray(allEids)) {
for (const eid of allEids) {
if (SOURCE_RTI_MAPPING[eid.source] && deepAccess(eid, 'uids.0')) {
if (SOURCE_RTI_MAPPING.hasOwnProperty(eid.source) && deepAccess(eid, 'uids.0')) {
seenSources[eid.source] = true;
eid.uids[0].ext = {
rtiPartner: SOURCE_RTI_MAPPING[eid.source]
};
if (SOURCE_RTI_MAPPING[eid.source] != '') {
eid.uids[0].ext = {
rtiPartner: SOURCE_RTI_MAPPING[eid.source]
};
}
delete eid.uids[0].atype;
toSend.push(eid);
}
}
}

const isValidFlocId = flocData && flocData.id && flocData.version;
if (isValidFlocId) {
const flocEid = {
Expand All @@ -466,6 +475,7 @@ function getEidInfo(allEids, flocData) {

return { toSend, seenSources };
}

/**
* Builds a request object to be sent to the ad server based on bid requests.
*
Expand Down
80 changes: 26 additions & 54 deletions test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,10 @@ describe('IndexexchangeAdapter', function () {
netId: 'testnetid123', // NetId
IDP: 'userIDP000', // IDP
fabrickId: 'fabrickId9000', // FabrickId
uid2: { id: 'testuid2' } // UID 2.0
// so structured because when calling createEidsArray, UID2's getValue func takes .id to set in uids
uid2: { id: 'testuid2' }, // UID 2.0
// similar to uid2, but id5's getValue takes .uid
id5id: { uid: 'testid5id' } // ID5
};

const DEFAULT_USERIDASEIDS_DATA = createEidsArray(DEFAULT_USERID_DATA);
Expand Down Expand Up @@ -481,12 +484,16 @@ describe('IndexexchangeAdapter', function () {
}, {
source: 'uidapi.com',
uids: [{
// when calling createEidsArray, UID2's getValue func returns .id, which is then set in uids
id: DEFAULT_USERID_DATA.uid2.id,
ext: {
rtiPartner: 'UID2'
}
}]
}, {
source: 'id5-sync.com',
uids: [{
id: DEFAULT_USERID_DATA.id5id.uid
}]
}
];

Expand Down Expand Up @@ -753,7 +760,7 @@ describe('IndexexchangeAdapter', function () {
const payload = JSON.parse(request[0].data.r);
expect(request).to.be.an('array');
expect(request).to.have.lengthOf.above(0); // should be 1 or more
expect(payload.user.eids).to.have.lengthOf(5);
expect(payload.user.eids).to.have.lengthOf(6);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
});
});
Expand Down Expand Up @@ -952,12 +959,8 @@ describe('IndexexchangeAdapter', function () {
const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
const payload = JSON.parse(request.data.r);

expect(payload.user.eids).to.have.lengthOf(5);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[1]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[2]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[3]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[4]);
expect(payload.user.eids).to.have.lengthOf(6);
expect(payload.user.eids).to.have.deep.members(DEFAULT_USERID_PAYLOAD);
});

it('IX adapter reads floc id from prebid userId and adds it to eids when there is not other eids', function () {
Expand All @@ -977,12 +980,8 @@ describe('IndexexchangeAdapter', function () {
const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
const payload = JSON.parse(request.data.r);

expect(payload.user.eids).to.have.lengthOf(6);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[1]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[2]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[3]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[4]);
expect(payload.user.eids).to.have.lengthOf(7);
expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
expect(payload.user.eids).to.deep.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
});

Expand All @@ -993,12 +992,8 @@ describe('IndexexchangeAdapter', function () {
const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
const payload = JSON.parse(request.data.r);

expect(payload.user.eids).to.have.lengthOf(5);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[1]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[2]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[3]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[4]);
expect(payload.user.eids).to.have.lengthOf(6);
expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
expect(payload.user.eids).should.not.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
});

Expand All @@ -1009,12 +1004,8 @@ describe('IndexexchangeAdapter', function () {
const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
const payload = JSON.parse(request.data.r);

expect(payload.user.eids).to.have.lengthOf(5);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[1]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[2]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[3]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[4]);
expect(payload.user.eids).to.have.lengthOf(6);
expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
expect(payload.user.eids).should.not.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
});

Expand All @@ -1025,12 +1016,8 @@ describe('IndexexchangeAdapter', function () {
const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
const payload = JSON.parse(request.data.r);

expect(payload.user.eids).to.have.lengthOf(5);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[1]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[2]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[3]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[4]);
expect(payload.user.eids).to.have.lengthOf(6);
expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
expect(payload.user.eids).should.not.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
});

Expand All @@ -1041,12 +1028,8 @@ describe('IndexexchangeAdapter', function () {
const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
const payload = JSON.parse(request.data.r);

expect(payload.user.eids).to.have.lengthOf(5);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[1]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[2]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[3]);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[4]);
expect(payload.user.eids).to.have.lengthOf(6);
expect(payload.user.eids).to.deep.include.members(DEFAULT_USERID_PAYLOAD);
expect(payload.user.eids).should.not.include(DEFAULT_FLOC_USERID_PAYLOAD[0]);
});

Expand Down Expand Up @@ -1179,15 +1162,9 @@ describe('IndexexchangeAdapter', function () {
})

expect(payload.user).to.exist;
expect(payload.user.eids).to.have.lengthOf(7);
expect(payload.user.eids).to.have.lengthOf(8);

expect(payload.user.eids).to.deep.include(validUserIdPayload[0]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[1]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[2]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[3]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[4]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[5]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[6]);
expect(payload.user.eids).to.have.deep.members(validUserIdPayload);
});

it('IXL and Prebid are mutually exclusive', function () {
Expand Down Expand Up @@ -1227,13 +1204,8 @@ describe('IndexexchangeAdapter', function () {
});

const payload = JSON.parse(request.data.r);
expect(payload.user.eids).to.have.lengthOf(6);
expect(payload.user.eids).to.deep.include(validUserIdPayload[0]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[1]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[2]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[3]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[4]);
expect(payload.user.eids).to.deep.include(validUserIdPayload[5]);
expect(payload.user.eids).to.have.lengthOf(7);
expect(payload.user.eids).to.have.deep.members(validUserIdPayload);
});
});

Expand Down