Skip to content

Commit

Permalink
IX Bid Adapter: Add support for ID5, Lotame Panorama ID, Epsilon Publ…
Browse files Browse the repository at this point in the history
…isher Link, Audigent Halo ID, SharedID (#7809)

* add id5, lotame panorama id, epsilon publink, audigent halo id

* add sharedId + diagnostics for pubProvidedId

Co-authored-by: Amy Yang <amy.yang@indexexchange.com>
  • Loading branch information
amykwyang and Amy Yang authored Dec 15, 2021
1 parent 07d1efc commit 2740872
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 60 deletions.
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 @@ -441,7 +441,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 @@ -482,12 +485,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 @@ -754,7 +761,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 @@ -953,12 +960,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 @@ -978,12 +981,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 @@ -994,12 +993,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 @@ -1010,12 +1005,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 @@ -1026,12 +1017,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 @@ -1042,12 +1029,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 @@ -1180,15 +1163,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 @@ -1228,13 +1205,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

0 comments on commit 2740872

Please sign in to comment.