Skip to content

Commit

Permalink
LiveIntent UserId module: Backport index id support (#10345)
Browse files Browse the repository at this point in the history
* Backport index id support

* Revert changes in package-lock.json

* Update eids.md
  • Loading branch information
3link committed Aug 10, 2023
1 parent 4c59c93 commit 243c3dc
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/liveIntentIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ export const liveIntentIdSubmodule = {
result.magnite = { 'id': value.magnite }
}

if (value.index) {
result.index = { 'id': value.index }
}

return result
}

Expand Down
14 changes: 14 additions & 0 deletions modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,20 @@ export const USER_IDS_CONFIG = {
}
},

// indexexchange
'index': {
source: 'liveintent.indexexchange.com',
atype: 3,
getValue: function(data) {
return data.id;
},
getUidExt: function(data) {
if (data.ext) {
return data.ext;
}
}
},

// britepoolId
'britepoolid': {
source: 'britepool.com',
Expand Down
8 changes: 8 additions & 0 deletions modules/userId/eids.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ userIdAsEids = [
}]
},
{
source: 'liveintent.indexexchange.com',
uids: [{
id: 'some-random-id-value',
atype: 3
}]
},
{
source: 'media.net',
uids: [{
Expand Down
33 changes: 33 additions & 0 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,39 @@ describe('eids array generation for known sub-modules', function() {
});
});

it('index', function() {
const userId = {
index: {'id': 'sample_id'}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'liveintent.indexexchange.com',
uids: [{
id: 'sample_id',
atype: 3
}]
});
});

it('magnite with ext', function() {
const userId = {
index: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'liveintent.indexexchange.com',
uids: [{
id: 'sample_id',
atype: 3,
ext: {
provider: 'some.provider.com'
}
}]
});
});

it('britepoolId', function() {
const userId = {
britepoolid: 'some-random-id-value'
Expand Down
5 changes: 5 additions & 0 deletions test/spec/modules/liveIntentIdMinimalSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ describe('LiveIntentMinimalId', function() {
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'magnite': 'bar'}, 'magnite': {'id': 'bar'}});
});

it('should decode an index id to a seperate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', index: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'index': 'bar'}, 'index': {'id': 'bar'}});
});

it('should allow disabling nonId resolution', function() {
let callBackSpy = sinon.spy();
let submoduleCallback = liveIntentIdSubmodule.getId({ params: {
Expand Down
5 changes: 5 additions & 0 deletions test/spec/modules/liveIntentIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@ describe('LiveIntentId', function() {
expect(result).to.eql({'uid2': {'id': 'bar'}});
});

it('should decode an index id to a seperate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', index: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'index': 'bar'}, 'index': {'id': 'bar'}});
});

it('should allow disabling nonId resolution', function() {
let callBackSpy = sinon.spy();
let submoduleCallback = liveIntentIdSubmodule.getId({ params: {
Expand Down

0 comments on commit 243c3dc

Please sign in to comment.