From 75670fc9e4992698d7fd783f363524de6b9c8420 Mon Sep 17 00:00:00 2001 From: ahmadlob <109217988+ahmadlob@users.noreply.github.com> Date: Thu, 28 Jul 2022 05:33:48 +0300 Subject: [PATCH] Taboola Bid Adapter: dynamic ttl (#8747) * update-ttl-passing * Update taboolaBidAdapter_spec.js * add fallback default value in case of null * add semicolons * . * . * . * .. * ... --- modules/taboolaBidAdapter.js | 5 ++-- test/spec/modules/taboolaBidAdapter_spec.js | 26 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/modules/taboolaBidAdapter.js b/modules/taboolaBidAdapter.js index 1a35f9e548e..e94e7aba7ca 100644 --- a/modules/taboolaBidAdapter.js +++ b/modules/taboolaBidAdapter.js @@ -222,9 +222,8 @@ function getBid(requestId, currency, bidResponse) { if (!bidResponse) { return; } - 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) { @@ -233,7 +232,7 @@ function getBid(requestId, currency, bidResponse) { return { requestId, - ttl: 60, + ttl, mediaType: BANNER, cpm, creativeId, diff --git a/test/spec/modules/taboolaBidAdapter_spec.js b/test/spec/modules/taboolaBidAdapter_spec.js index 4749a6a5919..739335e8f1f 100644 --- a/test/spec/modules/taboolaBidAdapter_spec.js +++ b/test/spec/modules/taboolaBidAdapter_spec.js @@ -311,6 +311,7 @@ describe('Taboola Adapter', function () { 'crid': '278195503434041083381', 'w': 300, 'h': 250, + 'exp': 60, 'lurl': 'http://us-trc.taboola.com/sample' } ], @@ -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 () {