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 UID2.0 #6628

Merged
merged 1 commit into from
Apr 20, 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
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 @@ -682,7 +692,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 @@ -877,16 +887,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 @@ -977,7 +987,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 @@ -1019,14 +1028,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 @@ -1048,7 +1058,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 @@ -1067,12 +1076,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