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

PrebidJS User Id module should share userIds in ORTB Eids format as well #4167

Closed
wants to merge 11 commits into from
14 changes: 14 additions & 0 deletions modules/criteortusIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ export const criteortusIdSubmodule = {
utils.logError('Error in parsing criteo rtus data', error);
}
},

// todo: who can confirm the format?
// todo: this code may not even work as Criteo is creating UID per bidder like bidRequests[0].userId.criteortus.appnexus.userid
ortbFormat: function(data, eidsArray) {
if (utils.isStr(data)) {
eidsArray.push({
source: 'criteortus',
uids: [{
id: data
}]
});
}
},

/**
* performs action to obtain id and return a value in the callback's response argument
* @function
Expand Down
18 changes: 18 additions & 0 deletions modules/digiTrustIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,24 @@ export const digiTrustIdSubmodule = {
utils.logError('DigiTrust ID submodule decode error');
}
},

// todo: Digitrust team to confirm the format
// https://github.com/digi-trust/dt-cdn/wiki/OpenRTB-extension
ortbFormat: function(data, eidsArray) {
if (utils.deepAccess(data, 'data.id')) {
eidsArray.push({
source: 'digitrust',
uids: [{
id: data.data.id,
atype: 1,
ext: {
keyv: data.data.keyv
}
}]
});
}
},

getId: getDigiTrustId,
_testInit: surfaceTestHook
};
Expand Down
12 changes: 12 additions & 0 deletions modules/id5IdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ export const id5IdSubmodule = {
decode(value) {
return (value && typeof value['ID5ID'] === 'string') ? { 'id5id': value['ID5ID'] } : undefined;
},

ortbFormat: function(data, eidsArray) {
if (utils.isStr(data)) {
eidsArray.push({
source: 'id5-sync.com',
uids: [{
id: data
}]
});
}
},

/**
* performs action to obtain id and return a value in the callback's response argument
* @function
Expand Down
13 changes: 13 additions & 0 deletions modules/identityLinkIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ export const identityLinkSubmodule = {
decode(value) {
return { 'idl_env': value }
},

// todo: who can confirm the format?
ortbFormat: function(data, eidsArray) {
if (utils.isStr(data)) {
eidsArray.push({
source: 'identityLink',
uids: [{
id: data
}]
});
}
},

/**
* performs action to obtain id and return a value in the callback's response argument
* @function
Expand Down
12 changes: 9 additions & 3 deletions modules/userId/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,13 @@ function getCombinedSubmoduleIds(submodules) {
}
const combinedSubmoduleIds = submodules.filter(i => utils.isPlainObject(i.idObj) && Object.keys(i.idObj).length).reduce((carry, i) => {
Object.keys(i.idObj).forEach(key => {
carry[key] = i.idObj[key];
carry.userId[key] = i.idObj[key];
if (utils.isFn(i.submodule.ortbFormat)) {
i.submodule.ortbFormat(i.idObj[key], carry.eids);
}
});
return carry;
}, {});
}, {userId: {}, eids: []});

return combinedSubmoduleIds;
}
Expand All @@ -230,7 +233,8 @@ function addIdDataToAdUnitBids(adUnits, submodules) {
adUnits.forEach(adUnit => {
adUnit.bids.forEach(bid => {
// create a User ID object on the bid,
bid.userId = combinedSubmoduleIds;
bid.userId = combinedSubmoduleIds.userId;
bid.userIdEids = combinedSubmoduleIds.eids;
});
});
}
Expand Down Expand Up @@ -459,6 +463,8 @@ export function init(config) {

// exposing getUserIds function in global-name-space so that userIds stored in Prebid can be used by external codes.
(getGlobal()).getUserIds = getUserIds;
// todo: need to change documentation of the output format
// todo: need to make changes in PR https://github.com/prebid/Prebid.js/pull/4140
}

// init config update listener to start the application
Expand Down
13 changes: 13 additions & 0 deletions modules/userId/pubCommonIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ export const pubCommonIdSubmodule = {
decode(value) {
return { 'pubcid': value }
},

// todo: who can confirm the format?
ortbFormat: function(data, eidsArray) {
if (utils.isStr(data)) {
eidsArray.push({
source: 'pubcommon',
uids: [{
id: data
}]
});
}
},

/**
* performs action to obtain id
* @function
Expand Down
15 changes: 15 additions & 0 deletions modules/userId/unifiedIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ export const unifiedIdSubmodule = {
decode(value) {
return (value && typeof value['TDID'] === 'string') ? { 'tdid': value['TDID'] } : undefined;
},

// todo: who can confirm the format?
ortbFormat: function(data, eidsArray) {
if (utils.isStr(data)) {
eidsArray.push({
source: 'adserver.org',
uids: [{
id: data,
ext: {
rtiPartner: 'TDID'
}
}]
});
}
},
/**
* performs action to obtain id and return a value in the callback's response argument
* @function
Expand Down