From 50089c759755f02652ef4945af01c74a9eb89631 Mon Sep 17 00:00:00 2001 From: Rok Susnik Date: Wed, 24 Mar 2021 13:48:12 +0100 Subject: [PATCH 1/4] add gvl id to spec --- modules/zemantaBidAdapter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/zemantaBidAdapter.js b/modules/zemantaBidAdapter.js index d0ac64e48e4..7519eacc3b1 100644 --- a/modules/zemantaBidAdapter.js +++ b/modules/zemantaBidAdapter.js @@ -10,6 +10,7 @@ import { ajax } from '../src/ajax.js'; import { config } from '../src/config.js'; const BIDDER_CODE = 'zemanta'; +const GVLID = 164; const CURRENCY = 'USD'; const NATIVE_ASSET_IDS = { 0: 'title', 2: 'icon', 3: 'image', 5: 'sponsoredBy', 4: 'body', 1: 'cta' }; const NATIVE_PARAMS = { @@ -23,7 +24,10 @@ const NATIVE_PARAMS = { export const spec = { code: BIDDER_CODE, - aliases: ['outbrain'], + gvlid: GVLID, + aliases: [ + { code: 'outbrain', gvlid: GVLID } + ], supportedMediaTypes: [ NATIVE, BANNER ], isBidRequestValid: (bid) => { return ( From ef6884dafc87640a149754ca185bd18b2f08d0fd Mon Sep 17 00:00:00 2001 From: Rok Susnik Date: Wed, 24 Mar 2021 13:48:46 +0100 Subject: [PATCH 2/4] add support for bcat and badv params --- modules/zemantaBidAdapter.js | 6 +++++- test/spec/modules/zemantaBidAdapter_spec.js | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/zemantaBidAdapter.js b/modules/zemantaBidAdapter.js index 7519eacc3b1..770e4641f08 100644 --- a/modules/zemantaBidAdapter.js +++ b/modules/zemantaBidAdapter.js @@ -41,6 +41,8 @@ export const spec = { const ua = navigator.userAgent; const test = setOnAny(validBidRequests, 'params.test'); const publisher = setOnAny(validBidRequests, 'params.publisher'); + const bcat = setOnAny(validBidRequests, 'params.bcat'); + const badv = setOnAny(validBidRequests, 'params.badv'); const cur = CURRENCY; const endpointUrl = config.getConfig('zemanta.bidderUrl') || config.getConfig('outbrain.bidderUrl'); const timeout = bidderRequest.timeout; @@ -77,7 +79,9 @@ export const spec = { source: { fd: 1 }, cur: [cur], tmax: timeout, - imp: imps + imp: imps, + bcat: bcat, + badv: badv, }; if (test) { diff --git a/test/spec/modules/zemantaBidAdapter_spec.js b/test/spec/modules/zemantaBidAdapter_spec.js index 0284abd41fd..62c5c37c45d 100644 --- a/test/spec/modules/zemantaBidAdapter_spec.js +++ b/test/spec/modules/zemantaBidAdapter_spec.js @@ -251,16 +251,24 @@ describe('Zemanta Adapter', function () { expect(res.data).to.deep.equal(JSON.stringify(expectedData)) }) - it('should pass optional tagid in request', function () { + it('should pass optional parameters in request', function () { const bidRequest = { ...commonBidRequest, ...nativeBidRequestParams, } bidRequest.params.tagid = 'test-tag' + bidRequest.params.publisher.name = 'test-publisher' + bidRequest.params.publisher.domain = 'test-publisher.com' + bidRequest.params.bcat = ['bad-category'] + bidRequest.params.badv = ['bad-advertiser'] const res = spec.buildRequests([bidRequest], commonBidderRequest) const resData = JSON.parse(res.data) expect(resData.imp[0].tagid).to.equal('test-tag') + expect(resData.site.publisher.name).to.equal('test-publisher') + expect(resData.site.publisher.domain).to.equal('test-publisher.com') + expect(resData.bcat).to.deep.equal(['bad-category']) + expect(resData.badv).to.deep.equal(['bad-advertiser']) }); it('should pass bidder timeout', function () { From 28c2714f80bd33ca2d21e05de0a7377b187f455b Mon Sep 17 00:00:00 2001 From: Rok Susnik Date: Wed, 24 Mar 2021 13:49:18 +0100 Subject: [PATCH 3/4] add consent strings to usersync url --- modules/zemantaBidAdapter.js | 12 +++++++-- test/spec/modules/zemantaBidAdapter_spec.js | 29 +++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/modules/zemantaBidAdapter.js b/modules/zemantaBidAdapter.js index 770e4641f08..582f0853d05 100644 --- a/modules/zemantaBidAdapter.js +++ b/modules/zemantaBidAdapter.js @@ -143,10 +143,18 @@ export const spec = { } }).filter(Boolean); }, - getUserSyncs: (syncOptions) => { + getUserSyncs: (syncOptions, responses, gdprConsent, uspConsent) => { const syncs = []; - const syncUrl = config.getConfig('zemanta.usersyncUrl') || config.getConfig('outbrain.usersyncUrl'); + let syncUrl = config.getConfig('zemanta.usersyncUrl') || config.getConfig('outbrain.usersyncUrl'); if (syncOptions.pixelEnabled && syncUrl) { + if (gdprConsent) { + syncUrl += '&gdpr=' + (gdprConsent.gdprApplies & 1); + syncUrl += '&gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || ''); + } + if (uspConsent) { + syncUrl += '&us_privacy=' + encodeURIComponent(uspConsent); + } + syncs.push({ type: 'image', url: syncUrl diff --git a/test/spec/modules/zemantaBidAdapter_spec.js b/test/spec/modules/zemantaBidAdapter_spec.js index 62c5c37c45d..8ee88b1eb23 100644 --- a/test/spec/modules/zemantaBidAdapter_spec.js +++ b/test/spec/modules/zemantaBidAdapter_spec.js @@ -470,10 +470,11 @@ describe('Zemanta Adapter', function () { }) describe('getUserSyncs', function () { - before(() => { + const usersyncUrl = 'https://usersync-url.com'; + beforeEach(() => { config.setConfig({ zemanta: { - usersyncUrl: 'https://usersync-url.com', + usersyncUrl: usersyncUrl, } } ) @@ -507,6 +508,30 @@ describe('Zemanta Adapter', function () { const ret = spec.getUserSyncs({pixelEnabled: true}) expect(ret).to.be.an('array').that.is.empty }) + + it('should pass GDPR consent', function() { + expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: true, consentString: 'foo'}, undefined)).to.deep.equal([{ + type: 'image', url: `${usersyncUrl}&gdpr=1&gdpr_consent=foo` + }]); + expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: false, consentString: 'foo'}, undefined)).to.deep.equal([{ + type: 'image', url: `${usersyncUrl}&gdpr=0&gdpr_consent=foo` + }]); + expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: true, consentString: undefined}, undefined)).to.deep.equal([{ + type: 'image', url: `${usersyncUrl}&gdpr=1&gdpr_consent=` + }]); + }); + + it('should pass US consent', function() { + expect(spec.getUserSyncs({ pixelEnabled: true }, {}, undefined, '1NYN')).to.deep.equal([{ + type: 'image', url: `${usersyncUrl}&us_privacy=1NYN` + }]); + }); + + it('should pass GDPR and US consent', function() { + expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: true, consentString: 'foo'}, '1NYN')).to.deep.equal([{ + type: 'image', url: `${usersyncUrl}&gdpr=1&gdpr_consent=foo&us_privacy=1NYN` + }]); + }); }) describe('onBidWon', function () { From b36851225471ee46b96e0eefb4bda37552230185 Mon Sep 17 00:00:00 2001 From: Rok Susnik Date: Wed, 24 Mar 2021 13:58:41 +0100 Subject: [PATCH 4/4] add bcat and badv params to doc --- modules/zemantaBidAdapter.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/zemantaBidAdapter.md b/modules/zemantaBidAdapter.md index d991b67d429..fa933ecd922 100644 --- a/modules/zemantaBidAdapter.md +++ b/modules/zemantaBidAdapter.md @@ -65,7 +65,9 @@ pbjs.setConfig({ name: 'Publishers Name', domain: 'publisher.com' }, - tagid: 'tag-id' + tagid: 'tag-id', + bcat: ['IAB1-1'], + badv: ['example.com'] } }] ]; @@ -94,7 +96,9 @@ pbjs.setConfig({ name: 'Publishers Name', domain: 'publisher.com' }, - tagid: 'tag-id' + tagid: 'tag-id', + bcat: ['IAB1-1'], + badv: ['example.com'] }, }] ];