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

adWMG Bid Adapter: update endpoints for cookie sync #6544

Merged
merged 20 commits into from
Apr 9, 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
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