From b9f9f88cbbcbc4cca52a3c72dcca8d94c8c863b5 Mon Sep 17 00:00:00 2001 From: nyakove <43004249+nyakove@users.noreply.github.com> Date: Fri, 9 Apr 2021 19:32:25 +0300 Subject: [PATCH] adWMG Bid Adapter: update endpoints for cookie sync (#6544) * Support floorCPM parameter, fix some minor bugs * fix space-in-parens circleci error * example fix * clean usersync URL * spaces * spaces * add new unit tests, compatibility with IE11 * remove logInfo * Check for floorCPM value * Check params before sending * New endpoints * code format * new endpoint for cookie sync * update tests Co-authored-by: Mikhail Dykun --- modules/adWMGBidAdapter.js | 24 ++++++++++++++++++----- test/spec/modules/adWMGBidAdapter_spec.js | 8 ++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/modules/adWMGBidAdapter.js b/modules/adWMGBidAdapter.js index 87c40db51e6..689e7d02124 100644 --- a/modules/adWMGBidAdapter.js +++ b/modules/adWMGBidAdapter.js @@ -6,8 +6,8 @@ import { config } from '../src/config.js'; import { BANNER } from '../src/mediaTypes.js'; const BIDDER_CODE = 'adWMG'; -const ENDPOINT = 'https://rtb.adwmg.com/prebid'; -let SYNC_ENDPOINT = 'https://rtb.adwmg.com/cphb.html?'; +const ENDPOINT = 'https://hb.adwmg.com/hb'; +let SYNC_ENDPOINT = 'https://hb.adwmg.com/cphb.html?'; export const spec = { code: BIDDER_CODE, @@ -34,11 +34,21 @@ export const spec = { const additional = spec.parseUserAgent(ua); return validBidRequests.map(bidRequest => { + const checkFloorValue = (value) => { + if (isNaN(parseFloat(value))) { + return 0; + } else return parseFloat(value); + } + const adUnit = { code: bidRequest.adUnitCode, bids: { bidder: bidRequest.bidder, - params: bidRequest.params + params: { + publisherId: bidRequest.params.publisherId, + IABCategories: bidRequest.params.IABCategories || [], + floorCPM: bidRequest.params.floorCPM ? checkFloorValue(bidRequest.params.floorCPM) : 0 + } }, mediaTypes: bidRequest.mediaTypes }; @@ -295,7 +305,11 @@ export const spec = { } } - return {devicetype: detectDevice(), os: detectOs().os, osv: detectOs().osv} + return { + devicetype: detectDevice(), + os: detectOs().os, + osv: detectOs().osv + } } -} +}; registerBidder(spec); diff --git a/test/spec/modules/adWMGBidAdapter_spec.js b/test/spec/modules/adWMGBidAdapter_spec.js index 1f881897fd8..8b927ace84c 100644 --- a/test/spec/modules/adWMGBidAdapter_spec.js +++ b/test/spec/modules/adWMGBidAdapter_spec.js @@ -168,8 +168,8 @@ describe('adWMGBidAdapter', function () { it('should have an url that match the default endpoint', function() { let requests = spec.buildRequests(bidRequests, bidderRequest); - expect(requests[0].url).to.equal('https://rtb.adwmg.com/prebid'); - expect(requests[1].url).to.equal('https://rtb.adwmg.com/prebid'); + expect(requests[0].url).to.equal('https://hb.adwmg.com/hb'); + expect(requests[1].url).to.equal('https://hb.adwmg.com/hb'); }); it('should contain GDPR consent data if GDPR set', function() { @@ -258,7 +258,7 @@ describe('adWMGBidAdapter', function () { let syncs = spec.getUserSyncs(syncOptions); expect(syncs[0].type).to.equal('iframe'); - expect(syncs[0].url).includes('https://rtb.adwmg.com/cphb.html?'); + expect(syncs[0].url).includes('https://hb.adwmg.com/cphb.html?'); }); it('should register iframe sync when iframe and image are enabled', function () { @@ -269,7 +269,7 @@ describe('adWMGBidAdapter', function () { let syncs = spec.getUserSyncs(syncOptions); expect(syncs[0].type).to.equal('iframe'); - expect(syncs[0].url).includes('https://rtb.adwmg.com/cphb.html?'); + expect(syncs[0].url).includes('https://hb.adwmg.com/cphb.html?'); }); it('should send GDPR consent if enabled', function() {