Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM-789 - Add magnite id resolution and eids mapping #14

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/liveIntentIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ export const liveIntentIdSubmodule = {
result.medianet = { 'id': value.medianet }
}

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

return result
}

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

// magnite
'magnite': {
source: 'rubiconproject.com',
atype: 3,
getValue: function(data) {
return data.id;
}
},

// britepoolId
'britepoolid': {
source: 'britepool.com',
Expand Down
15 changes: 15 additions & 0 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,21 @@ describe('eids array generation for known sub-modules', function() {
});
});

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

it('liveIntentId; getValue call and NO ext', function() {
const userId = {
lipb: {
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 @@ -323,6 +323,11 @@ describe('LiveIntentId', function() {
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar'}});
});

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

it('should decode values with uid2 but no nonId', function() {
const result = liveIntentIdSubmodule.decode({ uid2: 'bar' });
expect(result).to.eql({'uid2': {'id': 'bar'}});
Expand Down