Skip to content

Commit

Permalink
Sharethrough Bid Adapter: bugfixes, removed unused methods, and one H…
Browse files Browse the repository at this point in the history
…TTP request per impression (prebid#7509)

* Ensure that a separate openRTB request object is created for each bid request.
Each request will have one imp object in the array for the imp field.

* Cleanup specs for Sharethrough adapter and ensure that mediaType is set from the request data (impression object) instead of passing all bid request data through to the adserver.

Co-authored-by: Josh Becker <[email protected]>
Co-authored-by: Eddy Pechuzal <[email protected]>

* Increment version of sharethrough adapter to v4.0.1 from v4.0.0

Co-authored-by: Josh Becker <[email protected]>
Co-authored-by: Eddy Pechuzal <[email protected]>

* Remove unnecessary strData attribute

* Remove extra newline

Co-authored-by: Josh Becker <[email protected]>
  • Loading branch information
epechuzal and Josh Becker authored Oct 5, 2021
1 parent 73615a3 commit ae55944
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 155 deletions.
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 { registerBidder } from '../src/adapters/bidderFactory.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

0 comments on commit ae55944

Please sign in to comment.