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

PBID-39: Fill out userIdAsEids object with UID extended data (IBA and CCPA optout status) #10

Merged
merged 8 commits into from
Jun 9, 2020
6 changes: 3 additions & 3 deletions modules/connectadBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const spec = {
})
}

if (validBidRequests[0].userId && typeof validBidRequests[0].userId === 'object' && (validBidRequests[0].userId.tdid || validBidRequests[0].userId.pubcid || validBidRequests[0].userId.lipb || validBidRequests[0].userId.id5id || validBidRequests[0].userId.parrableid)) {
if (validBidRequests[0].userId && typeof validBidRequests[0].userId === 'object' && (validBidRequests[0].userId.tdid || validBidRequests[0].userId.pubcid || validBidRequests[0].userId.lipb || validBidRequests[0].userId.id5id || validBidRequests[0].userId.parrableId)) {
utils.deepSetValue(data, 'user.ext.eids', []);

if (validBidRequests[0].userId.tdid) {
Expand Down Expand Up @@ -118,11 +118,11 @@ export const spec = {
});
}

if (validBidRequests[0].userId.parrableid) {
if (validBidRequests[0].userId.parrableId) {
data.user.ext.eids.push({
source: 'parrable.com',
uids: [{
id: validBidRequests[0].userId.parrableid,
id: validBidRequests[0].userId.parrableId.eid,
}]
});
}
Expand Down
2 changes: 1 addition & 1 deletion modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const USER_ID_CODE_TO_QUERY_ARG = {
idl_env: 'lre', // LiveRamp IdentityLink
lipb: 'lipbid', // LiveIntent ID
netId: 'netid', // netID
parrableid: 'parrableid', // Parrable ID
parrableId: 'parrableid', // Parrable ID
pubcid: 'pubcid', // PubCommon ID
tdid: 'ttduuid', // The Trade Desk Unified ID
};
Expand Down
4 changes: 2 additions & 2 deletions modules/ozoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export const spec = {
*/
findAllUserIds(bidRequest) {
var ret = {};
let searchKeysSingle = ['pubcid', 'tdid', 'id5id', 'parrableid', 'idl_env', 'digitrustid', 'criteortus'];
let searchKeysSingle = ['pubcid', 'tdid', 'id5id', 'parrableId', 'idl_env', 'digitrustid', 'criteortus'];
utils.logInfo('OZONE: debug iterating keys');
utils.logInfo('OZONE: debug bidRequest=', bidRequest);
if (bidRequest.hasOwnProperty('userId')) {
Expand Down Expand Up @@ -585,7 +585,7 @@ export const spec = {
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);
this.addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.parrableid`), 'parrable.com', 1);
this.addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.parrableId.eid`), 'parrable.com', 1);
}
return eids;
},
Expand Down
2 changes: 1 addition & 1 deletion modules/parrableIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const parrableIdSubmodule = {
*/
decode(parrableId) {
if (parrableId && utils.isPlainObject(parrableId)) {
return { 'parrableid': parrableId.eid };
return { parrableId };
}
return undefined;
},
Expand Down
2 changes: 1 addition & 1 deletion modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ function _handleEids(payload, validBidRequests) {
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.criteoId`), 'criteo.com', 1);// replacing criteoRtus
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.idl_env`), 'liveramp.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.lipb.lipbid`), 'liveintent.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.parrableid`), 'parrable.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.parrableId.eid`), 'parrable.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.britepoolid`), 'britepool.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.netId`), 'netid.de', 1);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/pulsepointBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ function user(bidRequest, bidderRequest) {
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, bidRequest.userId.parrableid, 'parrable.com');
addExternalUserId(ext.eids, utils.deepAccess(bidRequest, 'userId.parrableId.eid'), 'parrable.com');
// liveintent
if (bidRequest.userId.lipb && bidRequest.userId.lipb.lipbid) {
addExternalUserId(ext.eids, bidRequest.userId.lipb.lipbid, 'liveintent.com');
Expand Down
24 changes: 22 additions & 2 deletions modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,29 @@ const USER_IDS_CONFIG = {
},

// parrableId
'parrableid': {
'parrableId': {
source: 'parrable.com',
atype: 1
atype: 1,
getValue: function(parrableId) {
if (parrableId.eid) {
return parrableId.eid;
}
if (parrableId.ccpaOptout) {
// If the EID was suppressed due to a non consenting ccpa optout then
// we still wish to provide this as a reason to the adapters
return '';
}
return null;
},
getUidExt: function(parrableId) {
const extendedData = utils.pick(parrableId, [
'ibaOptout',
'ccpaOptout'
]);
if (Object.keys(extendedData).length) {
return extendedData;
}
}
},

// identityLink
Expand Down
4 changes: 3 additions & 1 deletion test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ describe('eids array generation for known sub-modules', function() {

it('parrableId', function() {
const userId = {
parrableid: 'some-random-id-value'
parrableId: {
eid: 'some-random-id-value'
}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ describe('OpenxAdapter', function () {
idl_env: '1111-idl_env',
lipb: {lipbid: '1111-lipb'},
netId: 'fH5A3n2O8_CZZyPoJVD-eabc6ECb7jhxCicsds7qSg',
parrableid: 'eidVersion.encryptionKeyReference.encryptedValue',
parrableId: { eid: 'eidVersion.encryptionKeyReference.encryptedValue' },
pubcid: '1111-pubcid',
tdid: '1111-tdid',
};
Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/ozoneBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var validBidRequestsWithUserIdData = [
params: { publisherId: '9876abcd12-3', customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}], lotameData: {'Profile': {'tpid': 'c8ef27a0d4ba771a81159f0d2e792db4', 'Audiences': {'Audience': [{'id': '99999', 'abbr': 'sports'}, {'id': '88888', 'abbr': 'movie'}, {'id': '77777', 'abbr': 'blogger'}], 'ThirdPartyAudience': [{'id': '123', 'name': 'Automobiles'}, {'id': '456', 'name': 'Ages: 30-39'}]}}}, placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { id: '2899ec066a91ff8', tagid: 'undefined', secure: 1, banner: { format: [{ w: 300, h: 250 }, { w: 300, h: 600 }], h: 250, topframe: 1, w: 300 } } ] },
sizes: [[300, 250], [300, 600]],
transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87',
userId: {'pubcid': '12345678', 'id5id': 'ID5-someId', 'criteortus': {'ozone': {'userid': 'critId123'}}, 'idl_env': 'liverampId', 'lipb': {'lipbid': 'lipbidId123'}, 'parrableid': 'parrableid123'}
userId: {'pubcid': '12345678', 'id5id': 'ID5-someId', 'criteortus': {'ozone': {'userid': 'critId123'}}, 'idl_env': 'liverampId', 'lipb': {'lipbid': 'lipbidId123'}, 'parrableId': {eid: 'parrableid123'}}
}
];
var validBidRequestsMinimal = [
Expand Down Expand Up @@ -1039,7 +1039,7 @@ describe('ozone Adapter', function () {
'id5id': '2222',
'idl_env': '3333',
'lipb': {'lipbid': '4444'},
'parrableid': 'eidVersion.encryptionKeyReference.encryptedValue',
'parrableId': {eid: 'eidVersion.encryptionKeyReference.encryptedValue'},
'pubcid': '5555',
'tdid': '6666'
};
Expand All @@ -1059,7 +1059,7 @@ describe('ozone Adapter', function () {
'id5id': '2222',
'idl_env': '3333',
'lipb': {'lipbid': '4444'},
'parrableid': 'eidVersion.encryptionKeyReference.encryptedValue',
'parrableId': {eid: 'eidVersion.encryptionKeyReference.encryptedValue'},
// 'pubcid': '5555', // remove pubcid from here to emulate the OLD module & cause the failover code to kick in
'tdid': '6666'
};
Expand Down
49 changes: 44 additions & 5 deletions test/spec/modules/parrableIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ describe('Parrable ID System', function() {
let eid = '01.123.4567890';
let parrableId = {
eid,
ccpaOptout: true
ibaOptout: true
};

expect(parrableIdSubmodule.decode(parrableId)).to.deep.equal({
parrableid: eid
parrableId
});
});
});
Expand All @@ -203,7 +203,7 @@ describe('Parrable ID System', function() {

beforeEach(function() {
adUnits = [getAdUnitMock()];
writeParrableCookie({ eid: P_COOKIE_EID });
writeParrableCookie({ eid: P_COOKIE_EID, ibaOptout: true });
setSubmoduleRegistry([parrableIdSubmodule]);
init(config);
config.setConfig(getConfigMock());
Expand All @@ -218,8 +218,47 @@ describe('Parrable ID System', function() {
requestBidsHook(function() {
adUnits.forEach(unit => {
unit.bids.forEach(bid => {
expect(bid).to.have.deep.nested.property('userId.parrableid');
expect(bid.userId.parrableid).to.equal(P_COOKIE_EID);
expect(bid).to.have.deep.nested.property('userId.parrableId');
expect(bid.userId.parrableId.eid).to.equal(P_COOKIE_EID);
expect(bid.userId.parrableId.ibaOptout).to.equal(true);
const parrableIdAsEid = bid.userIdAsEids.find(e => e.source == 'parrable.com');
expect(parrableIdAsEid).to.deep.equal({
source: 'parrable.com',
uids: [{
id: P_COOKIE_EID,
atype: 1,
ext: {
ibaOptout: true
}
}]
});
});
});
done();
}, { adUnits });
});

it('supplies an optout reason when the EID is missing due to CCPA non-consent', function(done) {
// the ID system itself will not write a cookie with an EID when CCPA=true
writeParrableCookie({ ccpaOptout: true });

requestBidsHook(function() {
adUnits.forEach(unit => {
unit.bids.forEach(bid => {
expect(bid).to.have.deep.nested.property('userId.parrableId');
expect(bid.userId.parrableId).to.not.have.property('eid');
expect(bid.userId.parrableId.ccpaOptout).to.equal(true);
const parrableIdAsEid = bid.userIdAsEids.find(e => e.source == 'parrable.com');
expect(parrableIdAsEid).to.deep.equal({
source: 'parrable.com',
uids: [{
id: '',
atype: 1,
ext: {
ccpaOptout: true
}
}]
});
});
});
done();
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ describe('S2S Adapter', function () {
criteoId: '44VmRDeUE3ZGJ5MzRkRVJHU3BIUlJ6TlFPQUFU',
tdid: 'abc123',
pubcid: '1234',
parrableid: '01.1563917337.test-eid',
parrableId: { eid: '01.1563917337.test-eid' },
lipb: {
lipbid: 'li-xyz',
segments: ['segA', 'segB']
Expand Down
12 changes: 6 additions & 6 deletions test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ describe('PubMatic adapter', function () {
describe('Parrable Id', function() {
it('send the Parrable id if it is present', function() {
bidRequests[0].userId = {};
bidRequests[0].userId.parrableid = 'parrable-user-id';
bidRequests[0].userId.parrableId = { eid: 'parrable-user-id' };
let request = spec.buildRequests(bidRequests, {});
let data = JSON.parse(request.data);
expect(data.user.eids).to.deep.equal([{
Expand All @@ -1873,21 +1873,21 @@ describe('PubMatic adapter', function () {
}]);
});

it('do not pass if not string', function() {
it('do not pass if not object with eid key', function() {
bidRequests[0].userId = {};
bidRequests[0].userId.parrableid = 1;
bidRequests[0].userId.parrableId = 1;
let request = spec.buildRequests(bidRequests, {});
let data = JSON.parse(request.data);
expect(data.user.eids).to.equal(undefined);
bidRequests[0].userId.parrableid = [];
bidRequests[0].userId.parrableId = [];
request = spec.buildRequests(bidRequests, {});
data = JSON.parse(request.data);
expect(data.user.eids).to.equal(undefined);
bidRequests[0].userId.parrableid = null;
bidRequests[0].userId.parrableId = null;
request = spec.buildRequests(bidRequests, {});
data = JSON.parse(request.data);
expect(data.user.eids).to.equal(undefined);
bidRequests[0].userId.parrableid = {};
bidRequests[0].userId.parrableId = {};
request = spec.buildRequests(bidRequests, {});
data = JSON.parse(request.data);
expect(data.user.eids).to.equal(undefined);
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/pulsepointBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ describe('PulsePoint Adapter Tests', function () {
criteoId: 'criteo_id234',
idl_env: 'idl_id123',
id5id: 'id5id_234',
parrableid: 'parrable_id234',
parrableId: { eid: 'parrable_id234' },
lipb: {
lipbid: 'liveintent_id123'
}
Expand Down