Skip to content

Commit

Permalink
adWMG Bid Adapter: update endpoints for cookie sync (prebid#6544)
Browse files Browse the repository at this point in the history
* 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 <m.dykun@wmgroup.us>
  • Loading branch information
2 people authored and marc_tappx committed Apr 13, 2021
1 parent 195572d commit b9f9f88
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
24 changes: 19 additions & 5 deletions modules/adWMGBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
};
Expand Down Expand Up @@ -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);
8 changes: 4 additions & 4 deletions test/spec/modules/adWMGBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 () {
Expand All @@ -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() {
Expand Down

0 comments on commit b9f9f88

Please sign in to comment.