From b12beecd76e72161b330ea405a69e0a542c6402f Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Thu, 5 Sep 2019 15:59:11 -0700 Subject: [PATCH 01/11] userId_subModule ortbFormat function support bid.userId the current userId object bid.userIdEids will have userId in ORTB eids format No unit test case are broken :) --- modules/userId/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 98d99f7d333..b97aa782f1a 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -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; } @@ -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; }); }); } @@ -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 From e8b9949ceb7da05a70947b429e06ff23ecf15924 Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Thu, 5 Sep 2019 15:59:37 -0700 Subject: [PATCH 02/11] adding support for ortbFormat function --- modules/userId/pubCommonIdSystem.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/userId/pubCommonIdSystem.js b/modules/userId/pubCommonIdSystem.js index f4d6b41a127..de8a07ca5a6 100644 --- a/modules/userId/pubCommonIdSystem.js +++ b/modules/userId/pubCommonIdSystem.js @@ -23,6 +23,18 @@ export const pubCommonIdSubmodule = { decode(value) { return { 'pubcid': value } }, + + ortbFormat: function(data, eidsArray) { + if (utils.isStr(data)) { + eidsArray.push({ + source: 'pubcommon', + uids: [{ + id: data + }] + }); + } + }, + /** * performs action to obtain id * @function From 6c530beb9b8ffa5478a41644c88dd5f5c7fd972f Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Thu, 5 Sep 2019 15:59:42 -0700 Subject: [PATCH 03/11] adding support for ortbFormat function --- modules/userId/unifiedIdSystem.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/userId/unifiedIdSystem.js b/modules/userId/unifiedIdSystem.js index 1bc369bb9fc..8e3498400e2 100644 --- a/modules/userId/unifiedIdSystem.js +++ b/modules/userId/unifiedIdSystem.js @@ -24,6 +24,20 @@ export const unifiedIdSubmodule = { decode(value) { return (value && typeof value['TDID'] === 'string') ? { 'tdid': value['TDID'] } : undefined; }, + + 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 From d3a35d4fbeaca00fadc9e5f3970776ee03606d0f Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Thu, 5 Sep 2019 16:28:24 -0700 Subject: [PATCH 04/11] added todo to confirm format --- modules/userId/pubCommonIdSystem.js | 1 + modules/userId/unifiedIdSystem.js | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/userId/pubCommonIdSystem.js b/modules/userId/pubCommonIdSystem.js index de8a07ca5a6..8755f8e59b1 100644 --- a/modules/userId/pubCommonIdSystem.js +++ b/modules/userId/pubCommonIdSystem.js @@ -24,6 +24,7 @@ export const pubCommonIdSubmodule = { return { 'pubcid': value } }, + // todo: who can confirm the format? ortbFormat: function(data, eidsArray) { if (utils.isStr(data)) { eidsArray.push({ diff --git a/modules/userId/unifiedIdSystem.js b/modules/userId/unifiedIdSystem.js index 8e3498400e2..6fa9bd8d2f0 100644 --- a/modules/userId/unifiedIdSystem.js +++ b/modules/userId/unifiedIdSystem.js @@ -25,6 +25,7 @@ export const unifiedIdSubmodule = { 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({ From a744b4d04e5b04dcc5d47acf84e160e6bd9e52f4 Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Thu, 5 Sep 2019 16:29:03 -0700 Subject: [PATCH 05/11] digitrust ortbFormat function support --- modules/digiTrustIdSystem.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/digiTrustIdSystem.js b/modules/digiTrustIdSystem.js index 17f6fd9f737..8db67e48ab5 100644 --- a/modules/digiTrustIdSystem.js +++ b/modules/digiTrustIdSystem.js @@ -342,6 +342,23 @@ export const digiTrustIdSubmodule = { utils.logError('DigiTrust ID submodule decode error'); } }, + + // todo: Digitrust team to confirm the format + 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 }; From 50f3fe0b19a471ba090330ff28bcd868a7220e8d Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Thu, 5 Sep 2019 16:34:23 -0700 Subject: [PATCH 06/11] indent --- modules/digiTrustIdSystem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/digiTrustIdSystem.js b/modules/digiTrustIdSystem.js index 8db67e48ab5..ac23eb19801 100644 --- a/modules/digiTrustIdSystem.js +++ b/modules/digiTrustIdSystem.js @@ -344,8 +344,8 @@ export const digiTrustIdSubmodule = { }, // todo: Digitrust team to confirm the format - ortbFormat: function(data, eidsArray){ - if(utils.deepAccess(data, 'data.id')){ + ortbFormat: function(data, eidsArray) { + if (utils.deepAccess(data, 'data.id')) { eidsArray.push({ source: 'digitrust', uids: [{ From 5294bfd47c48d0578811fe15478612d684b4b510 Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Thu, 5 Sep 2019 16:38:31 -0700 Subject: [PATCH 07/11] id5id: ortbFormat function support --- modules/id5IdSystem.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/id5IdSystem.js b/modules/id5IdSystem.js index 7ed1fdf6bf3..8fbf6e4aa6b 100644 --- a/modules/id5IdSystem.js +++ b/modules/id5IdSystem.js @@ -25,6 +25,19 @@ export const id5IdSubmodule = { decode(value) { return (value && typeof value['ID5ID'] === 'string') ? { 'id5id': value['ID5ID'] } : undefined; }, + + // todo: who can confirm the format? + ortbFormat: function(data, eidsArray){ + if (utils.isStr(data)) { + eidsArray.push({ + source: 'id5id', + uids: [{ + id: data + }] + }); + } + }, + /** * performs action to obtain id and return a value in the callback's response argument * @function From e93c17dd466ecd0ff76134ba326461e156d84781 Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Thu, 5 Sep 2019 16:39:52 -0700 Subject: [PATCH 08/11] indent --- modules/id5IdSystem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/id5IdSystem.js b/modules/id5IdSystem.js index 8fbf6e4aa6b..09f0c3d7146 100644 --- a/modules/id5IdSystem.js +++ b/modules/id5IdSystem.js @@ -27,12 +27,12 @@ export const id5IdSubmodule = { }, // todo: who can confirm the format? - ortbFormat: function(data, eidsArray){ + ortbFormat: function(data, eidsArray) { if (utils.isStr(data)) { eidsArray.push({ source: 'id5id', uids: [{ - id: data + id: data }] }); } From 22362c200ddadc437e541290addc1eb5d5da121c Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Thu, 5 Sep 2019 16:59:06 -0700 Subject: [PATCH 09/11] ortbFormat function support in id5id and criteortus --- modules/criteortusIdSystem.js | 14 ++++++++++++++ modules/identityLinkIdSystem.js | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/modules/criteortusIdSystem.js b/modules/criteortusIdSystem.js index 02edf0ef06e..7ffdc55db34 100644 --- a/modules/criteortusIdSystem.js +++ b/modules/criteortusIdSystem.js @@ -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 diff --git a/modules/identityLinkIdSystem.js b/modules/identityLinkIdSystem.js index 9aca5f85adf..d7dff4ebefb 100644 --- a/modules/identityLinkIdSystem.js +++ b/modules/identityLinkIdSystem.js @@ -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 From 164d0d2ff1cd1e72a83a1bab9478ff4daaab6f48 Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Fri, 6 Sep 2019 13:48:56 -0700 Subject: [PATCH 10/11] id5: updated the source --- modules/id5IdSystem.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/id5IdSystem.js b/modules/id5IdSystem.js index 09f0c3d7146..04fe4475d6e 100644 --- a/modules/id5IdSystem.js +++ b/modules/id5IdSystem.js @@ -26,11 +26,10 @@ export const id5IdSubmodule = { return (value && typeof value['ID5ID'] === 'string') ? { 'id5id': value['ID5ID'] } : undefined; }, - // todo: who can confirm the format? ortbFormat: function(data, eidsArray) { if (utils.isStr(data)) { eidsArray.push({ - source: 'id5id', + source: 'id5-sync.com', uids: [{ id: data }] From 326c91c1623296ac656da831d63f5de88be81745 Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Fri, 6 Sep 2019 15:16:53 -0700 Subject: [PATCH 11/11] added link for digitrust ortb documentation --- modules/digiTrustIdSystem.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/digiTrustIdSystem.js b/modules/digiTrustIdSystem.js index ac23eb19801..bb7272459d4 100644 --- a/modules/digiTrustIdSystem.js +++ b/modules/digiTrustIdSystem.js @@ -344,6 +344,7 @@ export const digiTrustIdSubmodule = { }, // 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({