Skip to content

Commit

Permalink
OpenX Adapter - support User ID module (#3529)
Browse files Browse the repository at this point in the history
* added universal id support to bid adapter

* added unit test for universal id support in bid adapter

* added universal id support to bid adapter

* added unit test for universal id support in bid adapter

* renamed universalID to userId

* removed merge mistake

* fix old code in test
  • Loading branch information
Isaac Dettman authored and bretg committed May 1, 2019
1 parent c48817c commit 1357e96
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) {
}
}

if (bids[0].crumbs && bids[0].crumbs.pubcid) {
if ((bids[0].userId && bids[0].userId.pubcid)) {
defaultParams.pubcid = bids[0].userId.pubcid;
} else if (bids[0].crumbs && bids[0].crumbs.pubcid) {
defaultParams.pubcid = bids[0].crumbs.pubcid;
}

Expand Down
24 changes: 24 additions & 0 deletions test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,30 @@ describe('OpenxAdapter', function () {
const request = spec.buildRequests(bidRequestsWithPubcid);
expect(request[0].data.pubcid).to.equal('c4a4c843-2368-4b5e-b3b1-6ee4702b9ad6');
});

it('should send a pubcid query param when userId.pubcid is defined in the bid requests', function () {
const bidRequestsWithPubcid = [{
bidder: 'openx',
params: {
unit: '11',
delDomain: 'test-del-domain'
},
userId: {
pubcid: 'c1a4c843-2368-4b5e-b3b1-6ee4702b9ad6'
},
adUnitCode: 'adunit-code',
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]]
}
},
bidId: 'test-bid-id-1',
bidderRequestId: 'test-bid-request-1',
auctionId: 'test-auction-1'
}];
const request = spec.buildRequests(bidRequestsWithPubcid);
expect(request[0].data.pubcid).to.equal('c1a4c843-2368-4b5e-b3b1-6ee4702b9ad6');
});
})
});

Expand Down

0 comments on commit 1357e96

Please sign in to comment.