Skip to content

Commit

Permalink
nextMillennium Bid Adapter: cookie sync URL (#9522)
Browse files Browse the repository at this point in the history
* if no response, use hardcoded URL

* lint added a space

* net rev true

* add test and fix queries (&)
  • Loading branch information
JacobKlein26 authored Feb 15, 2023
1 parent 16166bd commit 7b7389c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/nextMillenniumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { getRefererInfo } from '../src/refererDetection.js';
const BIDDER_CODE = 'nextMillennium';
const ENDPOINT = 'https://pbs.nextmillmedia.com/openrtb2/auction';
const TEST_ENDPOINT = 'https://test.pbs.nextmillmedia.com/openrtb2/auction';
const SYNC_ENDPOINT = 'https://cookies.nextmillmedia.com/sync?';
const REPORT_ENDPOINT = 'https://report2.hb.brainlyads.com/statistics/metric';
const TIME_TO_LIVE = 360;
const VIDEO_PARAMS = [
Expand Down Expand Up @@ -182,7 +183,7 @@ export const spec = {
height: bid.h,
creativeId: bid.adid,
currency: response.cur,
netRevenue: false,
netRevenue: true,
ttl: TIME_TO_LIVE,
meta: {
advertiserDomains: bid.adomain || []
Expand Down Expand Up @@ -231,6 +232,13 @@ export const spec = {
})
}

if (!pixels.length) {
let syncUrl = SYNC_ENDPOINT;
if (gdprConsent && gdprConsent.gdprApplies) syncUrl += 'gdpr=1&gdpr_consent=' + gdprConsent.consentString + '&';
if (uspConsent) syncUrl += 'us_privacy=' + uspConsent + '&';
if (syncOptions.iframeEnabled) pixels.push({type: 'iframe', url: syncUrl + 'type=iframe'});
if (syncOptions.pixelEnabled) pixels.push({type: 'image', url: syncUrl + 'type=image'});
}
return pixels;
},

Expand Down
11 changes: 11 additions & 0 deletions test/spec/modules/nextMillenniumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@ describe('nextMillenniumBidAdapterTests', function() {
expect(userSync[0].url).to.equal('urlB');
});

it('Test getUserSyncs with no response', function () {
const syncOptions = {
'iframeEnabled': true,
'pixelEnabled': false
}
let userSync = spec.getUserSyncs(syncOptions, [], bidRequestData[0].gdprConsent, bidRequestData[0].uspConsent);
expect(userSync).to.be.an('array')
expect(userSync[0].type).to.equal('iframe')
expect(userSync[0].url).to.equal('https://cookies.nextmillmedia.com/sync?gdpr=1&gdpr_consent=kjfdniwjnifwenrif3&us_privacy=1---&type=iframe')
})

it('Test getUserSyncs function if GDPR is undefined', function () {
const syncOptions = {
'iframeEnabled': false,
Expand Down

0 comments on commit 7b7389c

Please sign in to comment.