Skip to content

Commit efae8f8

Browse files
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
1 parent 0b75199 commit efae8f8

File tree

4 files changed

+114
-10
lines changed

4 files changed

+114
-10
lines changed

modules/userId/eids.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const USER_IDS_CONFIG = {
1515
'tdid': {
1616
source: 'adserver.org',
1717
atype: 1,
18-
ext: function() {
18+
getUidExt: function() {
1919
return {
2020
rtiPartner: 'TDID'
2121
};
@@ -47,7 +47,7 @@ const USER_IDS_CONFIG = {
4747
},
4848
source: 'liveintent.com',
4949
atype: 1,
50-
ext: function(data) {
50+
getEidExt: function(data) {
5151
if (Array.isArray(data.segments) && data.segments.length) {
5252
return {
5353
segments: data.segments
@@ -88,16 +88,27 @@ const USER_IDS_CONFIG = {
8888
function createEidObject(userIdData, subModuleKey) {
8989
const conf = USER_IDS_CONFIG[subModuleKey];
9090
if (conf && userIdData) {
91+
let eid = {};
92+
eid.source = conf['source'];
9193
const value = utils.isFn(conf['getValue']) ? conf['getValue'](userIdData) : userIdData;
9294
if (value) {
9395
const uid = { id: value, atype: conf['atype'] };
94-
if (utils.isFn(conf['ext'])) {
95-
const ext = conf['ext'](userIdData);
96-
if (ext) {
97-
uid.ext = ext;
96+
// getUidExt
97+
if (utils.isFn(conf['getUidExt'])) {
98+
const uidExt = conf['getUidExt'](userIdData);
99+
if (uidExt) {
100+
uid.ext = uidExt;
98101
}
99102
}
100-
return { source: conf['source'], uids: [uid] };
103+
eid.uids = [uid];
104+
// getEidExt
105+
if (utils.isFn(conf['getEidExt'])) {
106+
const eidExt = conf['getEidExt'](userIdData);
107+
if (eidExt) {
108+
eid.ext = eidExt;
109+
}
110+
}
111+
return eid;
101112
}
102113
}
103114
return null;

modules/userId/eids.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
## Example of eids array generated by UserId Module.
2+
```
3+
userIdAsEids = [
4+
{
5+
source: 'pubcid.org',
6+
uids: [{
7+
id: 'some-random-id-value',
8+
atype: 1
9+
}]
10+
},
11+
12+
{
13+
source: 'adserver.org',
14+
uids: [{
15+
id: 'some-random-id-value',
16+
atype: 1,
17+
ext: {
18+
rtiPartner: 'TDID'
19+
}
20+
}]
21+
},
22+
23+
{
24+
source: 'id5-sync.com',
25+
uids: [{
26+
id: 'some-random-id-value',
27+
atype: 1
28+
}]
29+
},
30+
31+
{
32+
source: 'parrable.com',
33+
uids: [{
34+
id: 'some-random-id-value',
35+
atype: 1
36+
}]
37+
},
38+
39+
{
40+
source: 'liveramp.com',
41+
uids: [{
42+
id: 'some-random-id-value',
43+
atype: 1
44+
}]
45+
},
46+
47+
{
48+
source: 'liveintent.com',
49+
uids: [{
50+
id: 'some-random-id-value',
51+
atype: 1
52+
}],
53+
ext: {
54+
segments: ['s1', 's2']
55+
}
56+
},
57+
58+
{
59+
source: 'britepool.com',
60+
uids: [{
61+
id: 'some-random-id-value',
62+
atype: 1
63+
}]
64+
},
65+
66+
{
67+
source: 'digitru.st',
68+
uids: [{
69+
id: 'some-random-id-value',
70+
atype: 1
71+
}]
72+
},
73+
74+
{
75+
source: 'criteo.com',
76+
uids: [{
77+
id: 'some-random-id-value',
78+
atype: 1
79+
}]
80+
},
81+
82+
{
83+
source: 'netid.de',
84+
uids: [{
85+
id: 'some-random-id-value',
86+
atype: 1
87+
}]
88+
}
89+
]
90+
```

test/spec/modules/eids_spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ describe('eids array generation for known sub-modules', function() {
7676
expect(newEids.length).to.equal(1);
7777
expect(newEids[0]).to.deep.equal({
7878
source: 'liveintent.com',
79-
uids: [{id: 'some-random-id-value', atype: 1, ext: {segments: ['s1', 's2']}}]
79+
uids: [{id: 'some-random-id-value', atype: 1}],
80+
ext: {segments: ['s1', 's2']}
8081
});
8182
});
8283

test/spec/modules/userId_spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,8 @@ describe('User ID', function() {
850850
expect(bid.userId.lipb.segments).to.include('123');
851851
expect(bid.userIdAsEids[0]).to.deep.equal({
852852
source: 'liveintent.com',
853-
uids: [{id: 'random-ls-identifier', atype: 1, ext: {segments: ['123']}}]
853+
uids: [{id: 'random-ls-identifier', atype: 1}],
854+
ext: {segments: ['123']}
854855
});
855856
});
856857
});
@@ -875,7 +876,8 @@ describe('User ID', function() {
875876
expect(bid.userId.lipb.segments).to.include('123');
876877
expect(bid.userIdAsEids[0]).to.deep.equal({
877878
source: 'liveintent.com',
878-
uids: [{id: 'random-cookie-identifier', atype: 1, ext: {segments: ['123']}}]
879+
uids: [{id: 'random-cookie-identifier', atype: 1}],
880+
ext: {segments: ['123']}
879881
});
880882
});
881883
});

0 commit comments

Comments
 (0)