Skip to content

Commit fe2f35e

Browse files
authored
LiveIntent UserId module: Add support for sovrn id (prebid#10783)
* Add EID translation for sovrn * Review comments: fix test
1 parent faec1bb commit fe2f35e

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed

modules/liveIntentIdSystem.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ export const liveIntentIdSubmodule = {
223223
result.pubmatic = { 'id': value.pubmatic, ext: { provider: LI_PROVIDER_DOMAIN } }
224224
}
225225

226+
if (value.sovrn) {
227+
result.sovrn = { 'id': value.sovrn, ext: { provider: LI_PROVIDER_DOMAIN } }
228+
}
229+
226230
return result
227231
}
228232

@@ -348,6 +352,18 @@ export const liveIntentIdSubmodule = {
348352
return data.ext;
349353
}
350354
}
355+
},
356+
'sovrn': {
357+
source: 'liveintent.sovrn.com',
358+
atype: 3,
359+
getValue: function(data) {
360+
return data.id;
361+
},
362+
getUidExt: function(data) {
363+
if (data.ext) {
364+
return data.ext;
365+
}
366+
}
351367
}
352368
}
353369
};

test/spec/modules/eids_spec.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,39 @@ describe('eids array generation for known sub-modules', function() {
238238
});
239239
});
240240

241+
it('sovrn', function() {
242+
const userId = {
243+
sovrn: {'id': 'sample_id'}
244+
};
245+
const newEids = createEidsArray(userId);
246+
expect(newEids.length).to.equal(1);
247+
expect(newEids[0]).to.deep.equal({
248+
source: 'liveintent.sovrn.com',
249+
uids: [{
250+
id: 'sample_id',
251+
atype: 3
252+
}]
253+
});
254+
});
255+
256+
it('sovrn with ext', function() {
257+
const userId = {
258+
sovrn: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}}
259+
};
260+
const newEids = createEidsArray(userId);
261+
expect(newEids.length).to.equal(1);
262+
expect(newEids[0]).to.deep.equal({
263+
source: 'liveintent.sovrn.com',
264+
uids: [{
265+
id: 'sample_id',
266+
atype: 3,
267+
ext: {
268+
provider: 'some.provider.com'
269+
}
270+
}]
271+
});
272+
});
273+
241274
it('magnite', function() {
242275
const userId = {
243276
magnite: {'id': 'sample_id'}

test/spec/modules/liveIntentIdMinimalSystem_spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ describe('LiveIntentMinimalId', function() {
261261
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
262262
});
263263

264+
it('should decode a sovrn id to a seperate object when present', function() {
265+
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sovrn: 'bar' });
266+
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sovrn': 'bar'}, 'sovrn': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
267+
});
268+
264269
it('should decode a magnite id to a seperate object when present', function() {
265270
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', magnite: 'bar' });
266271
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'magnite': 'bar'}, 'magnite': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});

test/spec/modules/liveIntentIdSystem_spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ describe('LiveIntentId', function() {
388388
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
389389
});
390390

391+
it('should decode a sovrn id to a seperate object when present', function() {
392+
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sovrn: 'bar' });
393+
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sovrn': 'bar'}, 'sovrn': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
394+
});
395+
391396
it('should decode a magnite id to a seperate object when present', function() {
392397
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', magnite: 'bar' });
393398
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'magnite': 'bar'}, 'magnite': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});

0 commit comments

Comments
 (0)