Skip to content

Commit

Permalink
Merge pull request #6 from taboola/update-bid-response-ttl-passing
Browse files Browse the repository at this point in the history
Update bid response ttl passing
  • Loading branch information
ahmadlob committed Jul 27, 2022
2 parents dc72879 + 42fe9d5 commit 18dfc42
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
5 changes: 2 additions & 3 deletions modules/taboolaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function getBid(requestId, currency, bidResponse) {
}

const {
price: cpm, crid: creativeId, adm: ad, w: width, h: height, adomain: advertiserDomains, meta = {}
price: cpm, crid: creativeId, adm: ad, w: width, h: height, exp: ttl, adomain: advertiserDomains, meta = {}
} = bidResponse;

if (advertiserDomains && advertiserDomains.length > 0) {
Expand All @@ -233,7 +233,7 @@ function getBid(requestId, currency, bidResponse) {

return {
requestId,
ttl: 60,
ttl,
mediaType: BANNER,
cpm,
creativeId,
Expand All @@ -245,5 +245,4 @@ function getBid(requestId, currency, bidResponse) {
netRevenue: false
};
}

registerBidder(spec);
26 changes: 26 additions & 0 deletions test/spec/modules/taboolaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ describe('Taboola Adapter', function () {
'crid': '278195503434041083381',
'w': 300,
'h': 250,
'exp': 60,
'lurl': 'http://us-trc.taboola.com/sample'
}
],
Expand Down Expand Up @@ -386,6 +387,31 @@ describe('Taboola Adapter', function () {
const res = spec.interpretResponse(serverResponse, request)
expect(res).to.deep.equal(expectedRes)
});

it('should set the correct ttl form the response', function () {
// set exp-ttl to be 125
const [bid] = serverResponse.body.seatbid[0].bid;
serverResponse.body.seatbid[0].bid[0].exp = 125
const expectedRes = [
{
requestId: request.bids[0].bidId,
cpm: bid.price,
creativeId: bid.crid,
ttl: 125,
netRevenue: false,
currency: serverResponse.body.cur,
mediaType: 'banner',
ad: bid.adm,
width: bid.w,
height: bid.h,
meta: {
'advertiserDomains': bid.adomain
},
}
]
const res = spec.interpretResponse(serverResponse, request)
expect(res).to.deep.equal(expectedRes)
});
})

describe('userData', function () {
Expand Down

0 comments on commit 18dfc42

Please sign in to comment.