Skip to content
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
27 changes: 26 additions & 1 deletion modules/nextMillenniumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BANNER } from '../src/mediaTypes.js';

const BIDDER_CODE = 'nextMillennium';
const ENDPOINT = 'https://pbs.nextmillmedia.com/openrtb2/auction';
const SYNC_ENDPOINT = 'https://statics.nextmillmedia.com/load-cookie.html?v=4';
const TIME_TO_LIVE = 360;

export const spec = {
Expand Down Expand Up @@ -89,7 +90,31 @@ export const spec = {
});

return bidResponses;
}
},

getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) {
if (!syncOptions.iframeEnabled) {
return
}

let syncurl = gdprConsent && gdprConsent.gdprApplies ? `${SYNC_ENDPOINT}&gdpr=1&gdpr_consent=${gdprConsent.consentString}` : SYNC_ENDPOINT

let bidders = []
if (responses) {
_each(responses, (response) => {
_each(Object.keys(response.body.ext.responsetimemillis), b => bidders.push(b))
})
}

if (bidders.length) {
syncurl += `&bidders=${bidders.join(',')}`
}

return [{
type: 'iframe',
url: syncurl
}];
},
};

registerBidder(spec);
12 changes: 12 additions & 0 deletions test/spec/modules/nextMillenniumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ describe('nextMillenniumBidAdapterTests', function() {
expect(JSON.parse(request[0].data).id).to.equal('b06c5141-fe8f-4cdf-9d7d-54415490a917');
});

it('Test getUserSyncs function', function () {
const syncOptions = {
'iframeEnabled': true
}
const userSync = spec.getUserSyncs(syncOptions);
expect(userSync).to.be.an('array').with.lengthOf(1);
expect(userSync[0].type).to.exist;
expect(userSync[0].url).to.exist;
expect(userSync[0].type).to.be.equal('iframe');
expect(userSync[0].url).to.be.equal('https://statics.nextmillmedia.com/load-cookie.html?v=4');
});

it('validate_response_params', function() {
const serverResponse = {
body: {
Expand Down