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

LiveIntent UserId module: Add support for bidswitch and medianet ids #9703

Merged
merged 10 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
8 changes: 8 additions & 0 deletions modules/liveIntentIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ export const liveIntentIdSubmodule = {
result.uid2 = { 'id': value.uid2 }
}

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

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

Comment on lines +190 to +197
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the reviewer: is there a better approach to expose multiple ids via a single user id module where each of the ids has its own config to create an eid out of it?

return result
}

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

// bidswitchId
'bidswitch': {
source: 'bidswitch.com',
atype: 508,
patmmccann marked this conversation as resolved.
Show resolved Hide resolved
getValue: function(data) {
return data.id;
}
},

// medianetId
'medianet': {
source: 'media.net',
atype: 3,
getValue: function(data) {
return data.id;
}
},

// britepoolId
'britepoolid': {
source: 'britepool.com',
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,36 @@ describe('eids array generation for known sub-modules', function() {
});
});

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

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

it('liveIntentId; getValue call and NO ext', function() {
const userId = {
lipb: {
Expand Down
10 changes: 10 additions & 0 deletions test/spec/modules/liveIntentIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,16 @@ describe('LiveIntentId', function() {
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'uid2': 'bar'}, 'uid2': {'id': 'bar'}});
});

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

it('should decode a medianet id to a seperate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', medianet: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'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