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

Apacdex Bid Adapter: add placementId param and optimize payload data #7236

Merged
merged 1 commit into from
Jul 30, 2021
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
17 changes: 11 additions & 6 deletions modules/apacdexBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const spec = {
if (!bid.params) {
return false;
}
if (!bid.params.siteId) {
if (!bid.params.siteId && !bid.params.placementId) {
return false;
}
if (!utils.deepAccess(bid, 'mediaTypes.banner') && !utils.deepAccess(bid, 'mediaTypes.video')) {
Expand All @@ -50,7 +50,6 @@ export const spec = {
},

buildRequests: function (validBidRequests, bidderRequest) {
let siteId;
let schain;
let eids;
let geo;
Expand All @@ -62,8 +61,6 @@ export const spec = {
test = config.getConfig('debug');

validBidRequests.forEach(bidReq => {
siteId = siteId || bidReq.params.siteId;

if (bidReq.schain) {
schain = schain || bidReq.schain
}
Expand Down Expand Up @@ -119,7 +116,6 @@ export const spec = {

var pageUrl = _extractTopWindowUrlFromBidderRequest(bidderRequest);
payload.site = {};
payload.site.id = siteId;
payload.site.page = pageUrl
payload.site.referrer = _extractTopWindowReferrerFromBidderRequest(bidderRequest);
payload.site.hostname = getDomain(pageUrl);
Expand Down Expand Up @@ -153,7 +149,16 @@ export const spec = {
payload.geo = geo;
}

payload.bids = bids;
payload.bids = bids.map(function (bid) {
return {
params: bid.params,
mediaTypes: bid.mediaTypes,
transactionId: bid.transactionId,
sizes: bid.sizes,
bidId: bid.bidId,
bidFloor: bid.bidFloor
}
});

return {
method: 'POST',
Expand Down
3 changes: 2 additions & 1 deletion test/spec/modules/apacdexBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ describe('ApacdexBidAdapter', function () {
expect(spec.isBidRequestValid(bid)).to.equal(false);
});

it('should return false if there is no siteId param', () => {
it('should return false if there is no siteId or placementId param', () => {
const bid = {
'bidder': 'apacdex',
'adUnitCode': 'adunit-code',
params: {
site_id: '1a2b3c4d5e6f1a2b3c4d',
placement_id: 'plcm12345678',
},
'mediaTypes': {
banner: {
Expand Down