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

OpenX Adapter: Added support for pubcid #3158

Merged
merged 1 commit into from
Oct 11, 2018
Merged
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
6 changes: 5 additions & 1 deletion modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {parse} from 'src/url';
const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
const BIDDER_CODE = 'openx';
const BIDDER_CONFIG = 'hb_pb';
const BIDDER_VERSION = '2.1.4';
const BIDDER_VERSION = '2.1.5';

let shouldSendBoPixel = true;

Expand Down Expand Up @@ -222,6 +222,10 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) {
}
}

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

return defaultParams;
}

Expand Down
31 changes: 31 additions & 0 deletions test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,37 @@ describe('OpenxAdapter', function () {
const request = spec.buildRequests(bidRequestsWithDnt);
expect(request[0].data.ns).to.equal(1);
});

describe('publisher common id query param', function() {
it('should not send a pubcid query param when there is no crumbs.pubcid defined in the bid requests', function () {
const request = spec.buildRequests(bidRequestsWithMediaType);
expect(request[0].data).to.not.have.any.keys('pubcid');
});

it('should send a pubcid query param when crumbs.pubcid is defined in the bid requests', function () {
const bidRequestsWithPubcid = [{
bidder: 'openx',
params: {
unit: '11',
delDomain: 'test-del-domain'
},
crumbs: {
pubcid: 'c4a4c843-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('c4a4c843-2368-4b5e-b3b1-6ee4702b9ad6');
});
})
});

describe('buildRequests for video', function () {
Expand Down