Skip to content

Commit

Permalink
PubMatic bid adapter to support NetId User Module (#5009)
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

* PubMatic to support NetId UserId sub-module
  • Loading branch information
pm-harshad-mane authored Mar 25, 2020
1 parent b24156c commit a1083ff
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ function _handleEids(payload, validBidRequests) {
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.lipb.lipbid`), 'liveintent.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.parrableid`), 'parrable.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.britepoolid`), 'britepool.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.netId`), 'netid.de', 1);
}
if (eids.length > 0) {
payload.user.eids = eids;
Expand Down
36 changes: 36 additions & 0 deletions test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,42 @@ describe('PubMatic adapter', function () {
expect(data.user.eids).to.equal(undefined);
});
});

describe('NetId', function() {
it('send the NetId if it is present', function() {
bidRequests[0].userId = {};
bidRequests[0].userId.netId = 'netid-user-id';
let request = spec.buildRequests(bidRequests, {});
let data = JSON.parse(request.data);
expect(data.user.eids).to.deep.equal([{
'source': 'netid.de',
'uids': [{
'id': 'netid-user-id',
'atype': 1
}]
}]);
});

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

it('Request params check for video ad', function () {
Expand Down

0 comments on commit a1083ff

Please sign in to comment.