Skip to content

Commit

Permalink
PubMatic to support LiveIntent User Id sub-module (#4306)
Browse files Browse the repository at this point in the history
* added support for pubcommon, digitrust, id5id

* added support for IdentityLink

* changed the source for id5

* added unit test cases

* changed source param for identityLink

* supporting LiveIntent Id in PubMatic adapter

* updated source for liveintent
  • Loading branch information
pm-harshad-mane authored and bretg committed Oct 15, 2019
1 parent c3ba14c commit 56b611f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ function _handleEids(payload, validBidRequests) {
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id`), 'id5-sync.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.criteortus.${BIDDER_CODE}.userid`), 'criteortus', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.idl_env`), 'liveramp.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.lipb.lipbid`), 'liveintent.com', 1);
}
if (eids.length > 0) {
payload.user.eids = eids;
Expand Down
38 changes: 37 additions & 1 deletion test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,43 @@ describe('PubMatic adapter', function () {
expect(data.user.eids).to.equal(undefined);
});
});
})

describe('LiveIntent Id', function() {
it('send the LiveIntent id if it is present', function() {
bidRequests[0].userId = {};
bidRequests[0].userId.lipb = { lipbid: 'live-intent-user-id' };
let request = spec.buildRequests(bidRequests, {});
let data = JSON.parse(request.data);
expect(data.user.eids).to.deep.equal([{
'source': 'liveintent.com',
'uids': [{
'id': 'live-intent-user-id',
'atype': 1
}]
}]);
});

it('do not pass if not string', function() {
bidRequests[0].userId = {};
bidRequests[0].userId.lipb = { lipbid: 1 };
let request = spec.buildRequests(bidRequests, {});
let data = JSON.parse(request.data);
expect(data.user.eids).to.equal(undefined);
bidRequests[0].userId.lipb.lipbid = [];
request = spec.buildRequests(bidRequests, {});
data = JSON.parse(request.data);
expect(data.user.eids).to.equal(undefined);
bidRequests[0].userId.lipb.lipbid = null;
request = spec.buildRequests(bidRequests, {});
data = JSON.parse(request.data);
expect(data.user.eids).to.equal(undefined);
bidRequests[0].userId.lipb.lipbid = {};
request = spec.buildRequests(bidRequests, {});
data = JSON.parse(request.data);
expect(data.user.eids).to.equal(undefined);
});
});
});

it('Request params check for video ad', function () {
let request = spec.buildRequests(videoBidRequests);
Expand Down

0 comments on commit 56b611f

Please sign in to comment.