From 375bbf35713342d8b4910b6ae2567d44ebd9ad08 Mon Sep 17 00:00:00 2001 From: Ahmad Lobany Date: Mon, 5 Sep 2022 18:01:04 +0300 Subject: [PATCH 1/5] support-dynamic-endpoint-url --- modules/taboolaBidAdapter.js | 5 +- modules/taboolaBidAdapter.md | 18 ++++--- test/spec/modules/taboolaBidAdapter_spec.js | 54 +++++++++++++++++++-- 3 files changed, 64 insertions(+), 13 deletions(-) diff --git a/modules/taboolaBidAdapter.js b/modules/taboolaBidAdapter.js index 8db98409a..2f521826d 100644 --- a/modules/taboolaBidAdapter.js +++ b/modules/taboolaBidAdapter.js @@ -9,7 +9,7 @@ import {getStorageManager} from '../src/storageManager.js'; const BIDDER_CODE = 'taboola'; const GVLID = 42; const CURRENCY = 'USD'; -export const END_POINT_URL = 'https://hb.bidder.taboola.com/TaboolaHBOpenRTBRequestHandlerServlet'; +export var END_POINT_URL = 'https://hb.bidder.taboola.com/TaboolaHBOpenRTBRequestHandlerServlet'; const USER_ID = 'user-id'; const STORAGE_KEY = `taboola global:${USER_ID}`; const COOKIE_KEY = 'trc_cookie_storage'; @@ -76,6 +76,9 @@ export const spec = { gvlid: GVLID, code: BIDDER_CODE, isBidRequestValid: (bidRequest) => { + if (bidRequest.params.url != null) { + END_POINT_URL = bidRequest.params.url; + } return !!(bidRequest.sizes && bidRequest.params && bidRequest.params.publisherId && diff --git a/modules/taboolaBidAdapter.md b/modules/taboolaBidAdapter.md index 33e725927..64df1da56 100644 --- a/modules/taboolaBidAdapter.md +++ b/modules/taboolaBidAdapter.md @@ -30,7 +30,8 @@ The Taboola Bidding adapter requires setup before beginning. Please contact us o publisherId: 'tester-pub', // your-publisher-id bidfloor: 0.25, // Optional - default is null bcat: ['IAB1-1'], // Optional - default is [] - badv: ['example.com'] // Optional - default is [] + badv: ['example.com'], // Optional - default is [] + url: 'https://example.com' // Optional - default is null } }] }]; @@ -38,12 +39,13 @@ The Taboola Bidding adapter requires setup before beginning. Please contact us o # Parameters -| Name | Scope | Description | Example | Type | -|----------------|----------|---------------------------------------------------------|----------------------------|--------------| -| `tagId` | required | Tag ID / Placement Name
| `'Below The Article'` | `String` | -| `publisherId` | required | Numeric Publisher ID
(as provided by Taboola) | `'1234567'` | `String` | -| `bcat` | optional | List of blocked advertiser categories (IAB) | `['IAB1-1']` | `Array` | -| `badv` | optional | Blocked Advertiser Domains | `'example.com'` | `String Url` | -| `bidfloor` | optional | CPM bid floor | `0.25` | `Float` | +| Name | Scope | Description | Example | Type | +|---------------|----------|----------------------------------------------------|-----------------------|--------------| +| `tagId` | required | Tag ID / Placement Name
| `'Below The Article'` | `String` | +| `publisherId` | required | Numeric Publisher ID
(as provided by Taboola) | `'1234567'` | `String` | +| `bcat` | optional | List of blocked advertiser categories (IAB) | `['IAB1-1']` | `Array` | +| `badv` | optional | Blocked Advertiser Domains | `'example.com'` | `String Url` | +| `bidfloor` | optional | CPM bid floor | `0.25` | `Float` | +| `url` | optional | Endpoint Url (only if provided by Taboola) | `https://example.com` | `String` | diff --git a/test/spec/modules/taboolaBidAdapter_spec.js b/test/spec/modules/taboolaBidAdapter_spec.js index 739335e8f..e3a2f0173 100644 --- a/test/spec/modules/taboolaBidAdapter_spec.js +++ b/test/spec/modules/taboolaBidAdapter_spec.js @@ -89,6 +89,32 @@ describe('Taboola Adapter', function () { } expect(spec.isBidRequestValid(bid)).to.equal(true) }) + + it('should succeed when url is null', function () { + const bid = { + bidder: 'taboola', + params: { + publisherId: 'publisherId', + tagId: 'below the article', + url: null + }, + ...displayBidRequestParams + } + expect(spec.isBidRequestValid(bid)).to.equal(true) + }) + + it('should succeed when url is filled', function () { + const bid = { + bidder: 'taboola', + params: { + publisherId: 'publisherId', + tagId: 'below the article', + url: 'https://example.com' + }, + ...displayBidRequestParams + } + expect(spec.isBidRequestValid(bid)).to.equal(true) + }) }) describe('buildRequests', function () { @@ -114,10 +140,10 @@ describe('Taboola Adapter', function () { w: displayBidRequestParams.sizes[0][0], h: displayBidRequestParams.sizes[0][1] }, - { - w: displayBidRequestParams.sizes[1][0], - h: displayBidRequestParams.sizes[1][1] - } + { + w: displayBidRequestParams.sizes[1][0], + h: displayBidRequestParams.sizes[1][1] + } ] }, 'tagid': commonBidRequest.params.tagId, @@ -148,6 +174,26 @@ describe('Taboola Adapter', function () { expect(res.url).to.equal(`${END_POINT_URL}/${commonBidRequest.params.publisherId}`); expect(res.data).to.deep.equal(JSON.stringify(expectedData)); + }); + + it('should fill the url when it is passed', function () { + const commonBidRequestWithUrl = { + bidder: 'taboola', + params: { + publisherId: 'publisherId', + tagId: 'placement name', + url: 'https://example.com' + }, + bidId: 'aa43860a-4644-442a-b5e0-93f268cs4d19', + auctionId: '65746dca-26f3-4186-be13-dfa63469b1b7', + } + const defaultBidRequestWithUrl = { + ...commonBidRequestWithUrl, + ...displayBidRequestParams, + } + const res = spec.buildRequests([defaultBidRequestWithUrl], commonBidderRequest); + + expect(res.url).to.equal(`${commonBidRequestWithUrl.params.url}/${commonBidRequest.params.publisherId}`); }) it('should pass optional parameters in request', function () { From 45b09d5a6f3bf2e82cbac688fc186ed674fe5972 Mon Sep 17 00:00:00 2001 From: Ahmad Lobany Date: Mon, 5 Sep 2022 18:02:05 +0300 Subject: [PATCH 2/5] support-dynamic-endpoint-url --- test/spec/modules/taboolaBidAdapter_spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/spec/modules/taboolaBidAdapter_spec.js b/test/spec/modules/taboolaBidAdapter_spec.js index e3a2f0173..8d29fdc79 100644 --- a/test/spec/modules/taboolaBidAdapter_spec.js +++ b/test/spec/modules/taboolaBidAdapter_spec.js @@ -140,10 +140,10 @@ describe('Taboola Adapter', function () { w: displayBidRequestParams.sizes[0][0], h: displayBidRequestParams.sizes[0][1] }, - { - w: displayBidRequestParams.sizes[1][0], - h: displayBidRequestParams.sizes[1][1] - } + { + w: displayBidRequestParams.sizes[1][0], + h: displayBidRequestParams.sizes[1][1] + } ] }, 'tagid': commonBidRequest.params.tagId, From 240ba76bc816c77246ea7dfe6a002bd090c32d57 Mon Sep 17 00:00:00 2001 From: Ahmad Lobany Date: Tue, 6 Sep 2022 00:26:53 +0300 Subject: [PATCH 3/5] support-dynamic-endpoint-url --- modules/taboolaBidAdapter.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/taboolaBidAdapter.js b/modules/taboolaBidAdapter.js index 2f521826d..487b9e8a0 100644 --- a/modules/taboolaBidAdapter.js +++ b/modules/taboolaBidAdapter.js @@ -9,7 +9,7 @@ import {getStorageManager} from '../src/storageManager.js'; const BIDDER_CODE = 'taboola'; const GVLID = 42; const CURRENCY = 'USD'; -export var END_POINT_URL = 'https://hb.bidder.taboola.com/TaboolaHBOpenRTBRequestHandlerServlet'; +export const END_POINT_URL = 'https://hb.bidder.taboola.com/TaboolaHBOpenRTBRequestHandlerServlet'; const USER_ID = 'user-id'; const STORAGE_KEY = `taboola global:${USER_ID}`; const COOKIE_KEY = 'trc_cookie_storage'; @@ -76,9 +76,6 @@ export const spec = { gvlid: GVLID, code: BIDDER_CODE, isBidRequestValid: (bidRequest) => { - if (bidRequest.params.url != null) { - END_POINT_URL = bidRequest.params.url; - } return !!(bidRequest.sizes && bidRequest.params && bidRequest.params.publisherId && @@ -88,6 +85,7 @@ export const spec = { const [bidRequest] = validBidRequests; const {refererInfo, gdprConsent = {}, uspConsent} = bidderRequest; const {publisherId} = bidRequest.params; + let {url = END_POINT_URL} = bidRequest.params; const site = getSiteProperties(bidRequest.params, refererInfo); const device = {ua: navigator.userAgent}; const imps = getImps(validBidRequests); @@ -131,7 +129,7 @@ export const spec = { regs }; - const url = [END_POINT_URL, publisherId].join('/'); + url = [url, publisherId].join('/'); return { url, From 362ec97b16742edc3aa11175bd6667bf52086985 Mon Sep 17 00:00:00 2001 From: Ahmad Lobany Date: Tue, 6 Sep 2022 10:03:46 +0300 Subject: [PATCH 4/5] support-dynamic-endpoint-url --- modules/taboolaBidAdapter.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/taboolaBidAdapter.md b/modules/taboolaBidAdapter.md index 64df1da56..33e725927 100644 --- a/modules/taboolaBidAdapter.md +++ b/modules/taboolaBidAdapter.md @@ -30,8 +30,7 @@ The Taboola Bidding adapter requires setup before beginning. Please contact us o publisherId: 'tester-pub', // your-publisher-id bidfloor: 0.25, // Optional - default is null bcat: ['IAB1-1'], // Optional - default is [] - badv: ['example.com'], // Optional - default is [] - url: 'https://example.com' // Optional - default is null + badv: ['example.com'] // Optional - default is [] } }] }]; @@ -39,13 +38,12 @@ The Taboola Bidding adapter requires setup before beginning. Please contact us o # Parameters -| Name | Scope | Description | Example | Type | -|---------------|----------|----------------------------------------------------|-----------------------|--------------| -| `tagId` | required | Tag ID / Placement Name
| `'Below The Article'` | `String` | -| `publisherId` | required | Numeric Publisher ID
(as provided by Taboola) | `'1234567'` | `String` | -| `bcat` | optional | List of blocked advertiser categories (IAB) | `['IAB1-1']` | `Array` | -| `badv` | optional | Blocked Advertiser Domains | `'example.com'` | `String Url` | -| `bidfloor` | optional | CPM bid floor | `0.25` | `Float` | -| `url` | optional | Endpoint Url (only if provided by Taboola) | `https://example.com` | `String` | +| Name | Scope | Description | Example | Type | +|----------------|----------|---------------------------------------------------------|----------------------------|--------------| +| `tagId` | required | Tag ID / Placement Name
| `'Below The Article'` | `String` | +| `publisherId` | required | Numeric Publisher ID
(as provided by Taboola) | `'1234567'` | `String` | +| `bcat` | optional | List of blocked advertiser categories (IAB) | `['IAB1-1']` | `Array` | +| `badv` | optional | Blocked Advertiser Domains | `'example.com'` | `String Url` | +| `bidfloor` | optional | CPM bid floor | `0.25` | `Float` | From b93e8b7550a7118dfaf2a43325bd74b54ec3aff6 Mon Sep 17 00:00:00 2001 From: Ahmad Lobany Date: Tue, 6 Sep 2022 10:07:31 +0300 Subject: [PATCH 5/5] support-dynamic-endpoint-url --- modules/taboolaBidAdapter.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/taboolaBidAdapter.md b/modules/taboolaBidAdapter.md index 33e725927..17aa76d0e 100644 --- a/modules/taboolaBidAdapter.md +++ b/modules/taboolaBidAdapter.md @@ -30,7 +30,8 @@ The Taboola Bidding adapter requires setup before beginning. Please contact us o publisherId: 'tester-pub', // your-publisher-id bidfloor: 0.25, // Optional - default is null bcat: ['IAB1-1'], // Optional - default is [] - badv: ['example.com'] // Optional - default is [] + badv: ['example.com'], // Optional - default is [] + url: ['https://example.com'] // Optional - default is null } }] }]; @@ -38,12 +39,13 @@ The Taboola Bidding adapter requires setup before beginning. Please contact us o # Parameters -| Name | Scope | Description | Example | Type | -|----------------|----------|---------------------------------------------------------|----------------------------|--------------| -| `tagId` | required | Tag ID / Placement Name
| `'Below The Article'` | `String` | -| `publisherId` | required | Numeric Publisher ID
(as provided by Taboola) | `'1234567'` | `String` | -| `bcat` | optional | List of blocked advertiser categories (IAB) | `['IAB1-1']` | `Array` | -| `badv` | optional | Blocked Advertiser Domains | `'example.com'` | `String Url` | -| `bidfloor` | optional | CPM bid floor | `0.25` | `Float` | +| Name | Scope | Description | Example | Type | +|---------------|----------|---------------------------------------------------------|----------------------------|--------------| +| `tagId` | required | Tag ID / Placement Name
| `'Below The Article'` | `String` | +| `publisherId` | required | Numeric Publisher ID
(as provided by Taboola) | `'1234567'` | `String` | +| `bcat` | optional | List of blocked advertiser categories (IAB) | `['IAB1-1']` | `Array` | +| `badv` | optional | Blocked Advertiser Domains | `'example.com'` | `String Url` | +| `bidfloor` | optional | CPM bid floor | `0.25` | `Float` | +| `url` | optional | Endpoint Url (only if provided by Taboola) | `https://example.com` | `String` |