Skip to content
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
5 changes: 2 additions & 3 deletions modules/taboolaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ export const spec = {
buildRequests: (validBidRequests, bidderRequest) => {
const [bidRequest] = validBidRequests;
const {refererInfo, gdprConsent = {}, uspConsent} = bidderRequest;
const {publisherId} = bidRequest.params;
let {url = END_POINT_URL} = bidRequest.params;
const {publisherId, endpointUrl} = bidRequest.params;
const site = getSiteProperties(bidRequest.params, refererInfo);
const device = {ua: navigator.userAgent};
const imps = getImps(validBidRequests);
Expand Down Expand Up @@ -129,7 +128,7 @@ export const spec = {
regs
};

url = [url, publisherId].join('/');
const url = [endpointUrl || END_POINT_URL, publisherId].join('/');

return {
url,
Expand Down
4 changes: 2 additions & 2 deletions modules/taboolaBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The Taboola Bidding adapter requires setup before beginning. Please contact us o
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
endpointUrl: ['https://example.com'] // Optional
}
}]
}];
Expand All @@ -46,6 +46,6 @@ The Taboola Bidding adapter requires setup before beginning. Please contact us o
| `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` |
| `endpointUrl` | optional | Endpoint Url (only if provided by Taboola) | `https://example.com` | `String` |


41 changes: 36 additions & 5 deletions test/spec/modules/taboolaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,20 @@ describe('Taboola Adapter', function () {
params: {
publisherId: 'publisherId',
tagId: 'below the article',
url: null
endpointUrl: null
},
...displayBidRequestParams
}
expect(spec.isBidRequestValid(bid)).to.equal(true)
})

it('should succeed when url is empty string', function () {
const bid = {
bidder: 'taboola',
params: {
publisherId: 'publisherId',
tagId: 'below the article',
endpointUrl: ''
},
...displayBidRequestParams
}
Expand All @@ -109,7 +122,7 @@ describe('Taboola Adapter', function () {
params: {
publisherId: 'publisherId',
tagId: 'below the article',
url: 'https://example.com'
endpointUrl: 'https://example.com'
},
...displayBidRequestParams
}
Expand Down Expand Up @@ -182,18 +195,36 @@ describe('Taboola Adapter', function () {
params: {
publisherId: 'publisherId',
tagId: 'placement name',
url: 'https://example.com'
endpointUrl: 'https://example.com'
},
bidId: 'aa43860a-4644-442a-b5e0-93f268cs4d19',
auctionId: '65746dca-26f3-4186-be13-dfa63469b1b7',
}
const defaultBidRequestWithUrl = {
let defaultBidRequestWithUrl = {
...commonBidRequestWithUrl,
...displayBidRequestParams,
}
const res = spec.buildRequests([defaultBidRequestWithUrl], commonBidderRequest);
expect(res.url).to.equal(`${commonBidRequestWithUrl.params.endpointUrl}/${commonBidRequest.params.publisherId}`);
})

expect(res.url).to.equal(`${commonBidRequestWithUrl.params.url}/${commonBidRequest.params.publisherId}`);
it('should fill default url when url param is empty string', function () {
const commonBidRequestWithUrl = {
bidder: 'taboola',
params: {
publisherId: 'publisherId',
tagId: 'placement name',
endpointUrl: ''
},
bidId: 'aa43860a-4644-442a-b5e0-93f268cs4d19',
auctionId: '65746dca-26f3-4186-be13-dfa63469b1b7',
}
let defaultBidRequestWithUrl = {
...commonBidRequestWithUrl,
...displayBidRequestParams,
}
const res = spec.buildRequests([defaultBidRequestWithUrl], commonBidderRequest);
expect(res.url).to.equal(`${END_POINT_URL}/${commonBidRequestWithUrl.params.publisherId}`);
})

it('should pass optional parameters in request', function () {
Expand Down