File tree Expand file tree Collapse file tree 4 files changed +114
-10
lines changed Expand file tree Collapse file tree 4 files changed +114
-10
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const USER_IDS_CONFIG = {
15
15
'tdid' : {
16
16
source : 'adserver.org' ,
17
17
atype : 1 ,
18
- ext : function ( ) {
18
+ getUidExt : function ( ) {
19
19
return {
20
20
rtiPartner : 'TDID'
21
21
} ;
@@ -47,7 +47,7 @@ const USER_IDS_CONFIG = {
47
47
} ,
48
48
source : 'liveintent.com' ,
49
49
atype : 1 ,
50
- ext : function ( data ) {
50
+ getEidExt : function ( data ) {
51
51
if ( Array . isArray ( data . segments ) && data . segments . length ) {
52
52
return {
53
53
segments : data . segments
@@ -88,16 +88,27 @@ const USER_IDS_CONFIG = {
88
88
function createEidObject ( userIdData , subModuleKey ) {
89
89
const conf = USER_IDS_CONFIG [ subModuleKey ] ;
90
90
if ( conf && userIdData ) {
91
+ let eid = { } ;
92
+ eid . source = conf [ 'source' ] ;
91
93
const value = utils . isFn ( conf [ 'getValue' ] ) ? conf [ 'getValue' ] ( userIdData ) : userIdData ;
92
94
if ( value ) {
93
95
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 ;
98
101
}
99
102
}
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 ;
101
112
}
102
113
}
103
114
return null ;
Original file line number Diff line number Diff line change
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
+ ```
Original file line number Diff line number Diff line change @@ -76,7 +76,8 @@ describe('eids array generation for known sub-modules', function() {
76
76
expect ( newEids . length ) . to . equal ( 1 ) ;
77
77
expect ( newEids [ 0 ] ) . to . deep . equal ( {
78
78
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' ] }
80
81
} ) ;
81
82
} ) ;
82
83
Original file line number Diff line number Diff line change @@ -850,7 +850,8 @@ describe('User ID', function() {
850
850
expect ( bid . userId . lipb . segments ) . to . include ( '123' ) ;
851
851
expect ( bid . userIdAsEids [ 0 ] ) . to . deep . equal ( {
852
852
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' ] }
854
855
} ) ;
855
856
} ) ;
856
857
} ) ;
@@ -875,7 +876,8 @@ describe('User ID', function() {
875
876
expect ( bid . userId . lipb . segments ) . to . include ( '123' ) ;
876
877
expect ( bid . userIdAsEids [ 0 ] ) . to . deep . equal ( {
877
878
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' ] }
879
881
} ) ;
880
882
} ) ;
881
883
} ) ;
You can’t perform that action at this time.
0 commit comments