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

Performax Bid Adapter: New bidder adapter #11325

Merged
merged 13 commits into from
May 7, 2024
75 changes: 75 additions & 0 deletions modules/performaxBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { deepSetValue, deepAccess } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER } from '../src/mediaTypes.js'
import { ortbConverter } from '../libraries/ortbConverter/converter.js';

const BIDDER_CODE = 'performax';
const BIDDER_SHORT_CODE = 'px';
const GVLID = 732
const ENDPOINT = 'https://dale.performax.cz/ortb'
const converter = ortbConverter({

imp(buildImp, bidRequest, context) {
const imp = buildImp(bidRequest, context);
deepSetValue(imp, 'tagid', bidRequest.params.tagid);
return imp;
},

bidResponse(buildBidResponse, bid, context) {
context.netRevenue = deepAccess(bid, 'netRevenue');
context.mediaType = deepAccess(bid, 'mediaType');
context.currency = deepAccess(bid, 'currency');

return buildBidResponse(bid, context)
},
context: {
ttl: 360,
}
})

export const spec = {
code: BIDDER_CODE,
aliases: [BIDDER_SHORT_CODE],
gvlid: GVLID,
supportedMediaTypes: [BANNER],

isBidRequestValid: function (bid) {
return !!bid.params.tagid;
},

buildRequests: function (bidRequests, bidderRequest) {
let data = converter.toORTB({bidderRequest, bidRequests})
return [{
method: 'POST',
url: ENDPOINT,
options: {'contentType': 'application/json'},
data: data
}]
},

interpretResponse: function (bidderResponse, request) {
if (!bidderResponse.body) return [];
const response = bidderResponse.body
const data = {

seatbid: response.seatbid.map(seatbid => ({
seat: seatbid.seat,
bid: seatbid.bid.map(bid => ({
impid: bid.imp_id,
w: bid.w,
h: bid.h,
requestId: request.data.id,
price: bid.price,
currency: response.cur,
adm: bid.adm,
crid: bid.id,
netRevenue: true,
mediaType: BANNER,
}))
}))
};
return converter.fromORTB({ response: data, request: request.data }).bids
},

}
registerBidder(spec);
36 changes: 36 additions & 0 deletions modules/performaxBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Overview

```
Module Name: Performax Bid Adapter
Module Type: Bidder Adapter
Maintainer: development@performax.cz
```

# Description

Connects to Performax exchange for bids.

Performax bid adapter supports Banner.


# Sample Banner Ad Unit: For Publishers

```javascript
var adUnits = [
{
code: 'performax-div',
mediaTypes: {
banner: { sizes: [[300, 300]]},

bids: [
{
bidder: "performax",
params: {
slotId: "sample" // required
ncolletti marked this conversation as resolved.
Show resolved Hide resolved
}
}
]
},}
];
```