Skip to content

Commit 9430b8f

Browse files
ahmadlobjorgeluisrocha
authored andcommitted
Taboola Bid Adapter: dynamic ttl (prebid#8747)
* update-ttl-passing * Update taboolaBidAdapter_spec.js * add fallback default value in case of null * add semicolons * . * . * . * .. * ...
1 parent 5f5d133 commit 9430b8f

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

modules/taboolaBidAdapter.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,8 @@ function getBid(requestId, currency, bidResponse) {
222222
if (!bidResponse) {
223223
return;
224224
}
225-
226225
const {
227-
price: cpm, crid: creativeId, adm: ad, w: width, h: height, adomain: advertiserDomains, meta = {}
226+
price: cpm, crid: creativeId, adm: ad, w: width, h: height, exp: ttl, adomain: advertiserDomains, meta = {}
228227
} = bidResponse;
229228

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

234233
return {
235234
requestId,
236-
ttl: 60,
235+
ttl,
237236
mediaType: BANNER,
238237
cpm,
239238
creativeId,

test/spec/modules/taboolaBidAdapter_spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ describe('Taboola Adapter', function () {
311311
'crid': '278195503434041083381',
312312
'w': 300,
313313
'h': 250,
314+
'exp': 60,
314315
'lurl': 'http://us-trc.taboola.com/sample'
315316
}
316317
],
@@ -386,6 +387,31 @@ describe('Taboola Adapter', function () {
386387
const res = spec.interpretResponse(serverResponse, request)
387388
expect(res).to.deep.equal(expectedRes)
388389
});
390+
391+
it('should set the correct ttl form the response', function () {
392+
// set exp-ttl to be 125
393+
const [bid] = serverResponse.body.seatbid[0].bid;
394+
serverResponse.body.seatbid[0].bid[0].exp = 125;
395+
const expectedRes = [
396+
{
397+
requestId: request.bids[0].bidId,
398+
cpm: bid.price,
399+
creativeId: bid.crid,
400+
ttl: 125,
401+
netRevenue: false,
402+
currency: serverResponse.body.cur,
403+
mediaType: 'banner',
404+
ad: bid.adm,
405+
width: bid.w,
406+
height: bid.h,
407+
meta: {
408+
'advertiserDomains': bid.adomain
409+
},
410+
}
411+
];
412+
const res = spec.interpretResponse(serverResponse, request);
413+
expect(res).to.deep.equal(expectedRes);
414+
});
389415
})
390416

391417
describe('userData', function () {

0 commit comments

Comments
 (0)