Skip to content

Commit

Permalink
IX Bid Adapter: Add support for UID2.0 (prebid#6628)
Browse files Browse the repository at this point in the history
  • Loading branch information
amykwyang authored and umakajan committed May 6, 2021
1 parent 7adbe37 commit 929d58a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
3 changes: 2 additions & 1 deletion modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ function getEidInfo(allEids) {
'liveramp.com': 'idl',
'netid.de': 'NETID',
'neustar.biz': 'fabrickId',
'zeotap.com': 'zeotapIdPlus'
'zeotap.com': 'zeotapIdPlus',
'uidapi.com': 'UID2'
};
var toSend = [];
var seenSources = {};
Expand Down
24 changes: 17 additions & 7 deletions test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ describe('IndexexchangeAdapter', function () {
netId: 'testnetid123', // NetId
IDP: 'userIDP000', // IDP
fabrickId: 'fabrickId9000', // FabrickId
uid2: {id: 'testuid2'} // UID 2.0
};

const DEFAULT_USERIDASEIDS_DATA = createEidsArray(DEFAULT_USERID_DATA);
Expand Down Expand Up @@ -448,6 +449,15 @@ describe('IndexexchangeAdapter', function () {
rtiPartner: 'zeotapIdPlus'
}
}]
}, {
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'
}
}]
}
];

Expand Down Expand Up @@ -686,7 +696,7 @@ describe('IndexexchangeAdapter', function () {
const payload = JSON.parse(request[0].data.r);
expect(request).to.be.an('array');
expect(request).to.have.lengthOf(1);
expect(payload.user.eids).to.have.lengthOf(4);
expect(payload.user.eids).to.have.lengthOf(5);
expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
});
});
Expand Down Expand Up @@ -881,16 +891,16 @@ describe('IndexexchangeAdapter', function () {

it('IX adapter reads supported user modules from Prebid and adds it to Video', function () {
const cloneValidBid = utils.deepClone(DEFAULT_VIDEO_VALID_BID);
// cloneValidBid[0].userId = utils.deepClone(DEFAULT_USERID_DATA);
cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
const payload = JSON.parse(request.data.r);

expect(payload.user.eids).to.have.lengthOf(4);
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]);
});

it('We continue to send in IXL identity info and Prebid takes precedence over IXL', function () {
Expand Down Expand Up @@ -981,7 +991,6 @@ describe('IndexexchangeAdapter', function () {
};

const cloneValidBid = utils.deepClone(DEFAULT_BANNER_VALID_BID);
// cloneValidBid[0].userId = utils.deepClone(DEFAULT_USERID_DATA);
cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);

const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
Expand Down Expand Up @@ -1023,14 +1032,15 @@ describe('IndexexchangeAdapter', function () {
})

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

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]);
});

it('IXL and Prebid are mutually exclusive', function () {
Expand All @@ -1052,7 +1062,6 @@ describe('IndexexchangeAdapter', function () {
};

const cloneValidBid = utils.deepClone(DEFAULT_VIDEO_VALID_BID);
// cloneValidBid[0].userId = utils.deepClone(DEFAULT_USERID_DATA);
cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);

const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
Expand All @@ -1071,12 +1080,13 @@ describe('IndexexchangeAdapter', function () {
});

const payload = JSON.parse(request.data.r);
expect(payload.user.eids).to.have.lengthOf(5);
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]);
});
});

Expand Down

0 comments on commit 929d58a

Please sign in to comment.