diff --git a/modules/ixBidAdapter.js b/modules/ixBidAdapter.js index bba0d136ca6..4e5606ce476 100644 --- a/modules/ixBidAdapter.js +++ b/modules/ixBidAdapter.js @@ -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', @@ -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 = [ @@ -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 = { @@ -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. * diff --git a/test/spec/modules/ixBidAdapter_spec.js b/test/spec/modules/ixBidAdapter_spec.js index ebb6ee0fee5..cdf70a799e3 100644 --- a/test/spec/modules/ixBidAdapter_spec.js +++ b/test/spec/modules/ixBidAdapter_spec.js @@ -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); @@ -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 + }] } ]; @@ -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]); }); }); @@ -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 () { @@ -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]); }); @@ -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]); }); @@ -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]); }); @@ -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]); }); @@ -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]); }); @@ -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 () { @@ -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); }); });