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

Sharethrough Bid Adapter: bugfixes, removed unused methods, and one HTTP request per impression #7509

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
31 changes: 12 additions & 19 deletions modules/sharethroughBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import * as utils from '../src/utils.js';
import { config } from '../src/config.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { createEidsArray } from './userId/eids.js';
import find from 'core-js-pure/features/array/find.js';

const VERSION = '4.0.0';
const VERSION = '4.0.1';
const BIDDER_CODE = 'sharethrough';
const SUPPLY_ID = 'WYu2BXv1';

Expand Down Expand Up @@ -141,16 +140,16 @@ export const sharethroughAdapterSpec = {
};
}).filter(imp => !!imp);

return {
method: 'POST',
url: STR_ENDPOINT,
data: {
...req,
imp: imps,
},
bidRequests,
bidderRequest,
};
return imps.map(impression => {
return {
method: 'POST',
url: STR_ENDPOINT,
data: {
...req,
imp: [impression],
},
};
});
},

interpretResponse: ({ body }, req) => {
Expand All @@ -159,16 +158,14 @@ export const sharethroughAdapterSpec = {
}

return body.seatbid[0].bid.map(bid => {
const request = matchRequest(bid.impid, req);

const response = {
requestId: bid.impid,
width: +bid.w,
height: +bid.h,
cpm: +bid.price,
creativeId: bid.crid,
dealId: bid.dealid || null,
mediaType: request.mediaTypes && request.mediaTypes.video ? VIDEO : BANNER,
mediaType: req.data.imp[0].video ? VIDEO : BANNER,
currency: body.cur || 'USD',
netRevenue: true,
ttl: 360,
Expand Down Expand Up @@ -270,10 +267,6 @@ function getProtocol() {
return window.location.protocol;
}

function matchRequest(id, request) {
return find(request.bidRequests, bid => bid.bidId === id);
}

// stub for ?? operator
function nullish(input, def) {
return input === null || input === undefined ? def : input;
Expand Down
Loading