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

theAdx Bid Adapter : deal support added #10802

Merged
merged 1 commit into from
Dec 7, 2023
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
12 changes: 10 additions & 2 deletions modules/theAdxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ export const spec = {
withCredentials: true,
},
bidder: 'theadx',
// TODO: is 'page' the right value here?
referrer: encodeURIComponent(bidderRequest.refererInfo.page || ''),
data: generatePayload(bidRequest, bidderRequest),
mediaTypes: bidRequest['mediaTypes'],
Expand Down Expand Up @@ -261,6 +260,7 @@ export const spec = {
ad: creative,
ttl: ttl || 3000,
creativeId: bid.crid,
dealId: bid.dealid || null,
netRevenue: true,
currency: responseBody.cur,
mediaType: mediaType,
Expand Down Expand Up @@ -466,11 +466,19 @@ let generateImpBody = (bidRequest, bidderRequest) => {
} else if (mediaTypes && mediaTypes.native) {
native = generateNativeComponent(bidRequest, bidderRequest);
}

const result = {
id: bidRequest.index,
tagid: bidRequest.params.tagId + '',
};

// deals support
if (bidRequest.params.deals && Array.isArray(bidRequest.params.deals) && bidRequest.params.deals.length > 0) {
result.pmp = {
deals: bidRequest.params.deals,
private_auction: 0,
};
}

if (banner) {
result['banner'] = banner;
}
Expand Down
19 changes: 10 additions & 9 deletions modules/theAdxBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Module that connects to TheAdx demand sources
{
bidder: "theadx",
params: {
pid: 1000, // publisher id
wid: 2000, //website id
tagId: 5000, //zone id
pid: 1, // publisher id
wid: 7, //website id
tagId: 19, //zone id
}
}
]
Expand All @@ -43,9 +43,10 @@ Module that connects to TheAdx demand sources
{
bidder: "theadx",
params: {
pid: 1000, // publisher id
wid: 2000, //website id
tagId: 5000, //zone id
pid: 1, // publisher id
wid: 7, //website id
tagId: 18, //zone id
deals:[{"id":"theadx:137"}] //optional
}
}
]
Expand Down Expand Up @@ -80,9 +81,9 @@ Module that connects to TheAdx demand sources
{
bidder: "theadx",
params: {
pid: 1000, // publisher id
wid: 2000, //website id
tagId: 5000, //zone id
pid: 1, // publisher id
wid: 7, //website id
tagId: 20, //zone id
}
}
]
Expand Down
72 changes: 72 additions & 0 deletions test/spec/modules/theAdxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,78 @@ describe('TheAdxAdapter', function () {
expect(processedBid.currency).to.equal(responseCurrency);
});

it('returns a valid deal bid response on sucessful banner request with deal', function () {
let incomingRequestId = 'XXtestingXX';
let responsePrice = 3.14

let responseCreative = 'sample_creative&{FOR_COVARAGE}';

let responseCreativeId = '274';
let responseCurrency = 'TRY';

let responseWidth = 300;
let responseHeight = 250;
let responseTtl = 213;
let dealId = 'theadx_deal_id';

let sampleResponse = {
id: '66043f5ca44ecd8f8769093b1615b2d9',
seatbid: [{
bid: [{
id: 'c21bab0e-7668-4d8f-908a-63e094c09197',
dealid: 'theadx_deal_id',
impid: '1',
price: responsePrice,
adid: responseCreativeId,
crid: responseCreativeId,
adm: responseCreative,
adomain: [
'www.domain.com'
],
cid: '274',
attr: [],
w: responseWidth,
h: responseHeight,
ext: {
ttl: responseTtl
}
}],
seat: '201',
group: 0
}],
bidid: 'c21bab0e-7668-4d8f-908a-63e094c09197',
cur: responseCurrency
};

let sampleRequest = {
bidId: incomingRequestId,
mediaTypes: {
banner: {}
},
requestId: incomingRequestId,
deals: [{id: dealId}]
};
let serverResponse = {
body: sampleResponse
}
let result = spec.interpretResponse(serverResponse, sampleRequest);

expect(result.length).to.equal(1);

let processedBid = result[0];

// expect(processedBid.requestId).to.equal(incomingRequestId);
expect(processedBid.cpm).to.equal(responsePrice);
expect(processedBid.width).to.equal(responseWidth);
expect(processedBid.height).to.equal(responseHeight);
expect(processedBid.ad).to.equal(responseCreative);
expect(processedBid.ttl).to.equal(responseTtl);
expect(processedBid.creativeId).to.equal(responseCreativeId);
expect(processedBid.netRevenue).to.equal(true);
expect(processedBid.currency).to.equal(responseCurrency);
expect(processedBid.dealId).to.equal(dealId);
});

it('returns an valid bid response on sucessful video request', function () {
let incomingRequestId = 'XXtesting-275XX';
let responsePrice = 6
Expand Down