Skip to content

Commit

Permalink
parrableIdSystem: Populate userIdAsEid with Parrable ID and Optout da…
Browse files Browse the repository at this point in the history
…ta (#5350)

* Add unit coverage for parrableIdSystem getId callback

* PBID-14: Pass uspString to Parrable as us_privacy query parameter

* PBID-14: Simplify parrableIdSystem us_privacy test

* PBID-14: Only send us_privacy to Parrable when a value exists

* PBID-11: Read new Parrable compound cookie _parrable_id

Migrating from legacy _parrable_eid cookie. The new cookie contains ibaOptout and ccpaOptout status fields

* Remove path check from parrableIdSystem url test

* PBID-11: Integrate Parrable compound cookie, consolidating old cookies

* PBID-11: Update parrableIdSystem requestBids hook test to support compound cookie value

* PBID-11: Small refactor to parrableIdSystem spec to support compound cookie

* PBID-11: Handle legacy ibaOptout as truthy value when migrating to compound cookie

* PBID-11: Add parrableIdSystem spec tests covering migration of legacy cookies

* PBID-11: Remove storage documentation from test pages and userId module docs

* PBID-11: Remove SUBMODULES_THAT_ALWAYS_REFRESH_ID feature from userId system

* PBID-11: Use better serialize implementation for Parrable compound cookie

* PBID-11: Update parrableIdSystem interface documentation

* Add missing extension to mock xhr import

* PBID-11: Try to access eid property only when parrableId object exists

* PBID-11: Construct parrableId from legacy cookies in same manner as compound cookie

* Use hardcoded expiration date for legacy cookies

* PBID-39: Return full parrableId object in decode method

* PBID-39: Update all adapters to use parrableId.eid for userId value

* PBID-39: Update config for ORTB EIDs to extract parrableId.eid as User UID value

* PBID-39: Pass Parrable IBA and CCPA optout status into ORTB EIDs list through UID extensions

* PBID-39: Pass a true CCPA optout status to adapters when the EID has been suppressed

The userId/eids module will not consider our ID system for inclusion in the EIDs object if our ID value is not a string.
Unfortunately when we write our cookie without an EID (in the case where CCPA optout is true) then the deserialized EID value is undefined, to save space in the cookie.

So this is a hack that will return an empty string when Prebid is building the EIDs object so that we can still pass our optout status to those that require it to understand why our ID may be missing.

* parrableIdSystem: Relocate new unit test from upstream

* PBID-39: Fallback to cookie values when backend response is missing components

Also handle another missed callback scenario if the response object parses to nothing

* PBID-39: Avoid breaking openx bid adapter when renaming our id system

* PBID-39: Use array find

* Use supported array find method in parrableIdSystem_spec

* Restore backwards-compatible parrableId passing to OpenxBidAdapter

* VidazooBidAdapter: Consume new parrableId format
  • Loading branch information
icflournoy authored Aug 4, 2020
1 parent 22f0974 commit a770ca7
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 25 deletions.
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
5 changes: 4 additions & 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 Expand Up @@ -276,6 +276,9 @@ function appendUserIdsToQueryParams(queryParams, userIds) {
case 'lipb':
queryParams[key] = userIdObjectOrValue.lipbid;
break;
case 'parrableId':
queryParams[key] = userIdObjectOrValue.eid;
break;
default:
queryParams[key] = userIdObjectOrValue;
}
Expand Down
4 changes: 2 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', 'id5id', 'parrableId', 'idl_env', 'digitrustid', 'criteortus'];
if (bidRequest.hasOwnProperty('userId')) {
for (let arrayId in searchKeysSingle) {
let key = searchKeysSingle[arrayId];
Expand Down Expand Up @@ -679,7 +679,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 @@ -204,7 +204,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/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 @@ -35,9 +35,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
5 changes: 4 additions & 1 deletion modules/vidazooBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const SUPPORTED_ID_SYSTEMS = {
'idl_env': 1,
'lipb': 1,
'netId': 1,
'parrableid': 1,
'parrableId': 1,
'pubcid': 1,
'tdid': 1,
};
Expand Down Expand Up @@ -112,6 +112,9 @@ function appendUserIdsToRequestPayload(payloadRef, userIds) {
case 'lipb':
payloadRef[key] = userId.lipbid;
break;
case 'parrableId':
payloadRef[key] = userId.eid;
break;
default:
payloadRef[key] = userId;
}
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
5 changes: 4 additions & 1 deletion test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,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 Expand Up @@ -1093,6 +1093,9 @@ describe('OpenxAdapter', function () {
case 'lipb':
userIdValue = EXAMPLE_DATA_BY_ATTR.lipb.lipbid;
break;
case 'parrableId':
userIdValue = EXAMPLE_DATA_BY_ATTR.parrableId.eid;
break;
default:
userIdValue = EXAMPLE_DATA_BY_ATTR[userIdProviderKey];
}
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 @@ -66,7 +66,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'}]}}}, 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 @@ -2121,7 +2121,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 @@ -2141,7 +2141,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
50 changes: 45 additions & 5 deletions test/spec/modules/parrableIdSystem_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect } from 'chai';
import find from 'core-js-pure/features/array/find.js';
import { config } from 'src/config.js';
import * as utils from 'src/utils.js';
import { newStorageManager } from 'src/storageManager.js';
Expand Down Expand Up @@ -189,11 +190,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 +204,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 +219,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 = find(bid.userIdAsEids, 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 = find(bid.userIdAsEids, 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 @@ -1126,7 +1126,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
4 changes: 2 additions & 2 deletions test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,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' };
bidRequests[0].userIdAsEids = createEidsArray(bidRequests[0].userId);
let request = spec.buildRequests(bidRequests, {});
let data = JSON.parse(request.data);
Expand All @@ -1530,7 +1530,7 @@ 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].userIdAsEids = createEidsArray(bidRequests[0].userId);
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
1 change: 1 addition & 0 deletions test/spec/modules/vidazooBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ describe('VidazooBidAdapter', function () {
switch (idSystemProvider) {
case 'digitrustid': return { data: { id: id } };
case 'lipb': return { lipbid: id };
case 'parrableId': return { eid: id };
default: return id;
}
})();
Expand Down

0 comments on commit a770ca7

Please sign in to comment.