Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Outbrain alias in Zemanta adapter #6203

Merged
merged 3 commits into from
Jan 21, 2021
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
7 changes: 4 additions & 3 deletions modules/zemantaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ const NATIVE_PARAMS = {

export const spec = {
code: BIDDER_CODE,
aliases: ['outbrain'],
supportedMediaTypes: [ NATIVE, BANNER ],
isBidRequestValid: (bid) => {
return (
!!config.getConfig('zemanta.bidderUrl') &&
(!!config.getConfig('zemanta.bidderUrl') || !!config.getConfig('outbrain.bidderUrl')) &&
!!utils.deepAccess(bid, 'params.publisher.id') &&
!!(bid.nativeParams || bid.sizes)
);
Expand All @@ -37,7 +38,7 @@ export const spec = {
const test = setOnAny(validBidRequests, 'params.test');
const publisher = setOnAny(validBidRequests, 'params.publisher');
const cur = CURRENCY;
const endpointUrl = config.getConfig('zemanta.bidderUrl');
const endpointUrl = config.getConfig('zemanta.bidderUrl') || config.getConfig('outbrain.bidderUrl');
const timeout = bidderRequest.timeout;

const imps = validBidRequests.map((bid, id) => {
Expand Down Expand Up @@ -136,7 +137,7 @@ export const spec = {
},
getUserSyncs: (syncOptions) => {
const syncs = [];
const syncUrl = config.getConfig('zemanta.usersyncUrl');
const syncUrl = config.getConfig('zemanta.usersyncUrl') || config.getConfig('outbrain.usersyncUrl');
if (syncOptions.pixelEnabled && syncUrl) {
syncs.push({
type: 'image',
Expand Down
28 changes: 28 additions & 0 deletions test/spec/modules/zemantaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,24 @@ describe('Zemanta Adapter', function () {
}
expect(spec.isBidRequestValid(bid)).to.equal(false)
})
it('should succeed with outbrain config', function () {
const bid = {
bidder: 'zemanta',
params: {
publisher: {
id: 'publisher-id',
}
},
...nativeBidRequestParams,
}
config.resetConfig()
config.setConfig({
outbrain: {
bidderUrl: 'https://bidder-url.com',
}
})
expect(spec.isBidRequestValid(bid)).to.equal(true)
})
it('should fail if bidder url is not set', function () {
const bid = {
bidder: 'zemanta',
Expand Down Expand Up @@ -460,6 +478,16 @@ describe('Zemanta Adapter', function () {
const ret = spec.getUserSyncs({pixelEnabled: true})
expect(ret).to.deep.equal([{type: 'image', url: 'https://usersync-url.com'}])
})
it('should return user sync if pixel enabled with outbrain config', function () {
config.resetConfig()
config.setConfig({
outbrain: {
usersyncUrl: 'https://usersync-url.com',
}
})
const ret = spec.getUserSyncs({pixelEnabled: true})
expect(ret).to.deep.equal([{type: 'image', url: 'https://usersync-url.com'}])
})

it('should not return user sync if pixel disabled', function () {
const ret = spec.getUserSyncs({pixelEnabled: false})
Expand Down