From 625b32515aa130fd6284d6b8dc5b535bdecffcaa Mon Sep 17 00:00:00 2001 From: Harshad Mane Date: Wed, 11 Mar 2020 10:59:35 -0700 Subject: [PATCH] Eids liveintent ext fix (#4944) * added support for pubcommon, digitrust, id5id * added support for IdentityLink * changed the source for id5 * added unit test cases * changed source param for identityLink * fixing liveintent-segments added separate functions in config for eid.ext and uid.ext liventent segments should have been in eid.ext not in eid.uids[].ext * added example of generated eids array * formating * commeneted a console log; avoiding lint error * fixed breaking test-cases --- modules/userId/eids.js | 25 ++++++--- modules/userId/eids.md | 90 ++++++++++++++++++++++++++++++++ test/spec/modules/eids_spec.js | 3 +- test/spec/modules/userId_spec.js | 6 ++- 4 files changed, 114 insertions(+), 10 deletions(-) create mode 100644 modules/userId/eids.md diff --git a/modules/userId/eids.js b/modules/userId/eids.js index 1a98da81032..bd3b9bac0ff 100644 --- a/modules/userId/eids.js +++ b/modules/userId/eids.js @@ -15,7 +15,7 @@ const USER_IDS_CONFIG = { 'tdid': { source: 'adserver.org', atype: 1, - ext: function() { + getUidExt: function() { return { rtiPartner: 'TDID' }; @@ -47,7 +47,7 @@ const USER_IDS_CONFIG = { }, source: 'liveintent.com', atype: 1, - ext: function(data) { + getEidExt: function(data) { if (Array.isArray(data.segments) && data.segments.length) { return { segments: data.segments @@ -88,16 +88,27 @@ const USER_IDS_CONFIG = { function createEidObject(userIdData, subModuleKey) { const conf = USER_IDS_CONFIG[subModuleKey]; if (conf && userIdData) { + let eid = {}; + eid.source = conf['source']; const value = utils.isFn(conf['getValue']) ? conf['getValue'](userIdData) : userIdData; if (value) { const uid = { id: value, atype: conf['atype'] }; - if (utils.isFn(conf['ext'])) { - const ext = conf['ext'](userIdData); - if (ext) { - uid.ext = ext; + // getUidExt + if (utils.isFn(conf['getUidExt'])) { + const uidExt = conf['getUidExt'](userIdData); + if (uidExt) { + uid.ext = uidExt; } } - return { source: conf['source'], uids: [uid] }; + eid.uids = [uid]; + // getEidExt + if (utils.isFn(conf['getEidExt'])) { + const eidExt = conf['getEidExt'](userIdData); + if (eidExt) { + eid.ext = eidExt; + } + } + return eid; } } return null; diff --git a/modules/userId/eids.md b/modules/userId/eids.md new file mode 100644 index 00000000000..baface1ab6f --- /dev/null +++ b/modules/userId/eids.md @@ -0,0 +1,90 @@ +## Example of eids array generated by UserId Module. +``` +userIdAsEids = [ + { + source: 'pubcid.org', + uids: [{ + id: 'some-random-id-value', + atype: 1 + }] + }, + + { + source: 'adserver.org', + uids: [{ + id: 'some-random-id-value', + atype: 1, + ext: { + rtiPartner: 'TDID' + } + }] + }, + + { + source: 'id5-sync.com', + uids: [{ + id: 'some-random-id-value', + atype: 1 + }] + }, + + { + source: 'parrable.com', + uids: [{ + id: 'some-random-id-value', + atype: 1 + }] + }, + + { + source: 'liveramp.com', + uids: [{ + id: 'some-random-id-value', + atype: 1 + }] + }, + + { + source: 'liveintent.com', + uids: [{ + id: 'some-random-id-value', + atype: 1 + }], + ext: { + segments: ['s1', 's2'] + } + }, + + { + source: 'britepool.com', + uids: [{ + id: 'some-random-id-value', + atype: 1 + }] + }, + + { + source: 'digitru.st', + uids: [{ + id: 'some-random-id-value', + atype: 1 + }] + }, + + { + source: 'criteo.com', + uids: [{ + id: 'some-random-id-value', + atype: 1 + }] + }, + + { + source: 'netid.de', + uids: [{ + id: 'some-random-id-value', + atype: 1 + }] + } +] +``` \ No newline at end of file diff --git a/test/spec/modules/eids_spec.js b/test/spec/modules/eids_spec.js index c5fbca60084..99c34d28a94 100644 --- a/test/spec/modules/eids_spec.js +++ b/test/spec/modules/eids_spec.js @@ -76,7 +76,8 @@ describe('eids array generation for known sub-modules', function() { expect(newEids.length).to.equal(1); expect(newEids[0]).to.deep.equal({ source: 'liveintent.com', - uids: [{id: 'some-random-id-value', atype: 1, ext: {segments: ['s1', 's2']}}] + uids: [{id: 'some-random-id-value', atype: 1}], + ext: {segments: ['s1', 's2']} }); }); diff --git a/test/spec/modules/userId_spec.js b/test/spec/modules/userId_spec.js index fb728ef904b..8df4ae4611a 100644 --- a/test/spec/modules/userId_spec.js +++ b/test/spec/modules/userId_spec.js @@ -850,7 +850,8 @@ describe('User ID', function() { expect(bid.userId.lipb.segments).to.include('123'); expect(bid.userIdAsEids[0]).to.deep.equal({ source: 'liveintent.com', - uids: [{id: 'random-ls-identifier', atype: 1, ext: {segments: ['123']}}] + uids: [{id: 'random-ls-identifier', atype: 1}], + ext: {segments: ['123']} }); }); }); @@ -875,7 +876,8 @@ describe('User ID', function() { expect(bid.userId.lipb.segments).to.include('123'); expect(bid.userIdAsEids[0]).to.deep.equal({ source: 'liveintent.com', - uids: [{id: 'random-cookie-identifier', atype: 1, ext: {segments: ['123']}}] + uids: [{id: 'random-cookie-identifier', atype: 1}], + ext: {segments: ['123']} }); }); });