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

Convert id5id to an object to support passing additional data points to platforms #5756

Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions modules/adheseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ function getAccount(validBidRequests) {
}

function getId5Id(validBidRequests) {
if (validBidRequests[0] && validBidRequests[0].userId && validBidRequests[0].userId.id5id) {
return validBidRequests[0].userId.id5id;
if (validBidRequests[0] && validBidRequests[0].userId && validBidRequests[0].userId.id5id && validBidRequests[0].userId.id5id.uid) {
return validBidRequests[0].userId.id5id.uid;
}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/adxcgBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ export const spec = {
beaconParams.tdid = validBidRequests[0].userId.tdid;
}

if (utils.isStr(utils.deepAccess(validBidRequests, '0.userId.id5id'))) {
beaconParams.id5id = validBidRequests[0].userId.id5id;
if (utils.isStr(utils.deepAccess(validBidRequests, '0.userId.id5id.uid'))) {
beaconParams.id5id = validBidRequests[0].userId.id5id.uid;
}

if (utils.isStr(utils.deepAccess(validBidRequests, '0.userId.idl_env'))) {
Expand Down
4 changes: 2 additions & 2 deletions modules/avocetBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export const spec = {

// ID5 identifier
let id5id;
if (bidRequests[0].userId && bidRequests[0].userId.id5id) {
id5id = bidRequests[0].userId.id5id;
if (bidRequests[0].userId && bidRequests[0].userId.id5id && bidRequests[0].userId.id5id.uid) {
id5id = bidRequests[0].userId.id5id.uid;
}

// Build the avocet ext object
Expand Down
2 changes: 1 addition & 1 deletion modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const spec = {
if (bid.userId) {
getUserId(placement.eids, bid.userId.britepoolid, 'britepool.com');
getUserId(placement.eids, bid.userId.idl_env, 'identityLink');
getUserId(placement.eids, bid.userId.id5id, 'id5-sync.com')
getUserId(placement.eids, utils.deepAccess(bid, 'userId.id5id.uid'), 'id5-sync.com', utils.deepAccess(bid, 'userId.id5id.ext'));
getUserId(placement.eids, bid.userId.tdid, 'adserver.org', {
rtiPartner: 'TDID'
});
Expand Down
2 changes: 1 addition & 1 deletion modules/districtmDMXBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const spec = {
let eids = [];
if (bidRequest[0] && bidRequest[0].userId) {
bindUserId(eids, utils.deepAccess(bidRequest[0], `userId.idl_env`), 'liveramp.com', 1);
bindUserId(eids, utils.deepAccess(bidRequest[0], `userId.id5id`), 'id5-sync.com', 1);
bindUserId(eids, utils.deepAccess(bidRequest[0], `userId.id5id.uid`), 'id5-sync.com', 1);
bindUserId(eids, utils.deepAccess(bidRequest[0], `userId.pubcid`), 'pubcid.org', 1);
bindUserId(eids, utils.deepAccess(bidRequest[0], `userId.tdid`), 'adserver.org', 1);
bindUserId(eids, utils.deepAccess(bidRequest[0], `userId.criteoId`), 'criteo.com', 1);
Expand Down
2 changes: 1 addition & 1 deletion modules/gamoshiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const spec = {

let eids = [];
if (bidRequest && bidRequest.userId) {
addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id`), 'id5-sync.com', 'ID5ID');
addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id.uid`), 'id5-sync.com', 'ID5ID');
addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.tdid`), 'adserver.org', 'TDID');
}
if (eids.length > 0) {
Expand Down
4 changes: 2 additions & 2 deletions modules/gridBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ function buildNewRequest(validBidRequests, bidderRequest) {
if (userId.tdid) {
userExt.unifiedid = userId.tdid;
}
if (userId.id5id) {
userExt.id5id = userId.id5id;
if (userId.id5id && userId.id5id.uid) {
userExt.id5id = userId.id5id.uid;
}
if (userId.digitrustid && userId.digitrustid.data && userId.digitrustid.data.id) {
userExt.digitrustid = userId.digitrustid.data.id;
Expand Down
17 changes: 15 additions & 2 deletions modules/id5IdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,27 @@ export const id5IdSubmodule = {
* @returns {(Object|undefined)}
*/
decode(value) {
let uid;
let linkType = 0;

if (value && typeof value.ID5ID === 'string') {
// don't lose our legacy value from cache
return { 'id5id': value.ID5ID };
uid = value.ID5ID;
} else if (value && typeof value.universal_uid === 'string') {
return { 'id5id': value.universal_uid };
uid = value.universal_uid;
linkType = value.link_type || linkType;
} else {
return undefined;
}

return {
'id5id': {
'uid': uid,
'ext': {
'linkType': linkType
}
}
};
},

/**
Expand Down
2 changes: 1 addition & 1 deletion modules/livewrappedBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function handleEids(bidRequests) {
const bidRequest = bidRequests[0];
if (bidRequest && bidRequest.userId) {
AddExternalUserId(eids, utils.deepAccess(bidRequest, `userId.pubcid`), 'pubcommon', 1); // Also add this to eids
AddExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id`), 'id5-sync.com', 1);
AddExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id.uid`), 'id5-sync.com', 1);
}
if (eids.length > 0) {
return {user: {ext: {eids}}};
Expand Down
3 changes: 3 additions & 0 deletions modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ function appendUserIdsToQueryParams(queryParams, userIds) {
case 'parrableId':
queryParams[key] = userIdObjectOrValue.eid;
break;
case 'id5id':
queryParams[key] = userIdObjectOrValue.uid;
break;
default:
queryParams[key] = userIdObjectOrValue;
}
Expand Down
8 changes: 6 additions & 2 deletions modules/ozoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ export const spec = {
*/
findAllUserIds(bidRequest) {
var ret = {};
let searchKeysSingle = ['pubcid', 'tdid', 'id5id', 'parrableId', 'idl_env', 'digitrustid', 'criteortus'];
let searchKeysSingle = ['pubcid', 'tdid', 'parrableId', 'idl_env', 'digitrustid', 'criteortus'];
if (bidRequest.hasOwnProperty('userId')) {
for (let arrayId in searchKeysSingle) {
let key = searchKeysSingle[arrayId];
Expand All @@ -551,6 +551,10 @@ export const spec = {
if (lipbid) {
ret['lipb'] = {'lipbid': lipbid};
}
var id5id = utils.deepAccess(bidRequest.userId, 'id5id.uid');
if (id5id) {
ret['id5id'] = id5id;
}
}
if (!ret.hasOwnProperty('pubcid')) {
var pubcid = utils.deepAccess(bidRequest, 'crumbs.pubcid');
Expand Down Expand Up @@ -675,7 +679,7 @@ export const spec = {
if (bidRequest && bidRequest.userId) {
this.addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.pubcid`), 'pubcid', 1);
this.addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.pubcid`), 'pubcommon', 1);
this.addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id`), 'id5-sync.com', 1);
this.addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id.uid`), 'id5-sync.com', 1);
this.addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.criteortus.${BIDDER_CODE}.userid`), 'criteortus', 1);
this.addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.idl_env`), 'liveramp.com', 1);
this.addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.lipb.lipbid`), 'liveintent.com', 1);
Expand Down
2 changes: 1 addition & 1 deletion modules/pulsepointBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ function user(bidRequest, bidderRequest) {
addExternalUserId(ext.eids, bidRequest.userId.britepoolid, 'britepool.com');
addExternalUserId(ext.eids, bidRequest.userId.criteoId, 'criteo');
addExternalUserId(ext.eids, bidRequest.userId.idl_env, 'identityLink');
addExternalUserId(ext.eids, bidRequest.userId.id5id, 'id5-sync.com');
addExternalUserId(ext.eids, utils.deepAccess(bidRequest, 'userId.id5id.uid'), 'id5-sync.com', utils.deepAccess(bidRequest, 'userId.id5id.ext'));
addExternalUserId(ext.eids, utils.deepAccess(bidRequest, 'userId.parrableId.eid'), 'parrable.com');
// liveintent
if (bidRequest.userId.lipb && bidRequest.userId.lipb.lipbid) {
Expand Down
2 changes: 1 addition & 1 deletion modules/richaudienceBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function raiSetEids(bid) {
let eids = [];

if (bid && bid.userId) {
raiSetUserId(bid, eids, 'id5-sync.com', utils.deepAccess(bid, `userId.id5id`));
raiSetUserId(bid, eids, 'id5-sync.com', utils.deepAccess(bid, `userId.id5id.uid`));
raiSetUserId(bid, eids, 'pubcommon', utils.deepAccess(bid, `userId.pubcid`));
raiSetUserId(bid, eids, 'criteo.com', utils.deepAccess(bid, `userId.criteoId`));
raiSetUserId(bid, eids, 'liveramp.com', utils.deepAccess(bid, `userId.idl_env`));
Expand Down
7 changes: 4 additions & 3 deletions modules/spotxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,15 @@ export const spec = {
}

// ID5 fied
if (bid && bid.userId && bid.userId.id5id) {
if (utils.deepAccess(bid, 'userId.id5id.uid')) {
userExt.eids = userExt.eids || [];
userExt.eids.push(
{
source: 'id5-sync.com',
uids: [{
id: bid.userId.id5id
}]
id: bid.userId.id5id.uid
}],
ext: bid.userId.id5id.ext || {}
}
)
}
Expand Down
10 changes: 9 additions & 1 deletion modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ const USER_IDS_CONFIG = {

// id5Id
'id5id': {
getValue: function(data) {
return data.uid
},
source: 'id5-sync.com',
atype: 1
atype: 1,
getEidExt: function(data) {
if (data.ext) {
return data.ext;
}
}
},

// parrableId
Expand Down
3 changes: 3 additions & 0 deletions modules/vidazooBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ function appendUserIdsToRequestPayload(payloadRef, userIds) {
case 'parrableId':
payloadRef[key] = userId.eid;
break;
case 'id5id':
payloadRef[key] = userId.uid;
break;
default:
payloadRef[key] = userId;
}
Expand Down
4 changes: 2 additions & 2 deletions modules/visxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export const spec = {
if (payloadUserId.tdid) {
payload.tdid = payloadUserId.tdid;
}
if (payloadUserId.id5id) {
payload.id5 = payloadUserId.id5id;
if (payloadUserId.id5id && payloadUserId.id5id.uid) {
payload.id5 = payloadUserId.id5id.uid;
}
if (payloadUserId.digitrustid && payloadUserId.digitrustid.data && payloadUserId.digitrustid.data.id) {
payload.dtid = payloadUserId.digitrustid.data.id;
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/adheseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('AdheseAdapter', function () {
});

it('should include id5 id as /x5 param', function () {
let req = spec.buildRequests([ bidWithParams({}, { 'id5id': 'ID5-1234567890' }) ], bidderRequest);
let req = spec.buildRequests([ bidWithParams({}, { 'id5id': { 'uid': 'ID5-1234567890' } }) ], bidderRequest);

expect(JSON.parse(req.data).parameters).to.deep.include({ 'x5': [ 'ID5-1234567890' ] });
});
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/adxcgBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ describe('AdxcgAdapter', function () {
let bid = deepClone([bidBanner]);
let bidderRequests = {};

bid[0].userId = {id5id: 'id5idsample'};
bid[0].userId = {id5id: {uid: 'id5idsample'}};

it('should send pubcid if available', function () {
let request = spec.buildRequests(bid, bidderRequests);
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/amxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('AmxBidAdapter', () => {
britepoolid: 'sample-britepool',
criteoId: 'sample-criteo',
digitrustid: {data: {id: 'sample-digitrust'}},
id5id: 'sample-id5',
id5id: {uid: 'sample-id5'},
idl_env: 'sample-liveramp',
lipb: {lipbid: 'sample-liveintent'},
netId: 'sample-netid',
Expand Down
4 changes: 3 additions & 1 deletion test/spec/modules/avocetBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ describe('Avocet adapter', function () {
placement: '012345678901234567890123',
},
userId: {
id5id: 'test'
id5id: {
uid: 'test'
}
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/colossussspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('ColossussspAdapter', function () {
bid.userId.britepoolid = 'britepoolid123';
bid.userId.idl_env = 'idl_env123';
bid.userId.tdid = 'tdid123';
bid.userId.id5id = 'id5id123'
bid.userId.id5id = { uid: 'id5id123' };
let serverRequest = spec.buildRequests([bid], bidderRequest);
it('Returns valid data if array of bids is valid', function () {
let data = serverRequest.data;
Expand Down
4 changes: 3 additions & 1 deletion test/spec/modules/districtmDmxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ const bidRequest = [{
id: {}
}
},
id5id: {},
id5id: {
uid: ''
},
pubcid: {},
tdid: {},
criteoId: {},
Expand Down
42 changes: 33 additions & 9 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,39 @@ describe('eids array generation for known sub-modules', function() {
});
});

it('id5Id', function() {
const userId = {
id5id: 'some-random-id-value'
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'id5-sync.com',
uids: [{id: 'some-random-id-value', atype: 1}]
describe('id5Id', function() {
it('does not include an ext if not provided', function() {
const userId = {
id5id: {
uid: 'some-random-id-value'
}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'id5-sync.com',
uids: [{ id: 'some-random-id-value', atype: 1 }]
});
});

it('includes ext if provided', function() {
const userId = {
id5id: {
uid: 'some-random-id-value',
ext: {
linkType: 0
}
}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'id5-sync.com',
uids: [{ id: 'some-random-id-value', atype: 1 }],
ext: {
linkType: 0
}
});
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/gamoshiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ describe('GamoshiAdapter', () => {
it('build request with ID5 Id', () => {
const bidRequestClone = utils.deepClone(bidRequest);
bidRequestClone.userId = {};
bidRequestClone.userId.id5id = 'id5-user-id';
bidRequestClone.userId.id5id = { uid: 'id5-user-id' };
let request = spec.buildRequests([bidRequestClone], bidRequestClone)[0];
expect(request.data.user.ext.eids).to.deep.equal([{
'source': 'id5-sync.com',
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/gridBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ describe('TheMediaGrid Adapter', function () {
const bidRequestsWithUserIds = bidRequests.map((bid) => {
return Object.assign({
userId: {
id5id: 'id5id_1',
id5id: { uid: 'id5id_1' },
tdid: 'tdid_1',
digitrustid: {data: {id: 'DTID', keyv: 4, privacy: {optout: false}, producer: 'ABC', version: 2}},
lipb: {lipbid: 'lipb_1'}
Expand Down
Loading