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

Get config cleanup of consent management #10668

Closed
Closed
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
8 changes: 5 additions & 3 deletions modules/aidemBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const converter = ortbConverter({
const request = buildRequest(imps, bidderRequest, context);
deepSetValue(request, 'at', 1);
setPrebidRequestEnvironment(request);
deepSetValue(request, 'regs', getRegs());
deepSetValue(request, 'regs', getRegs(bidderRequest));
deepSetValue(request, 'site.publisher.id', bidderRequest.bids[0].params.publisherId);
deepSetValue(request, 'site.id', bidderRequest.bids[0].params.siteId);
return request;
Expand Down Expand Up @@ -106,9 +106,11 @@ function recur(obj) {
return result;
}

function getRegs() {
function getRegs(bidRequest) {
const ortb2Data = bidRequest?.ortb2 || {};

let regs = {};
const consentManagement = config.getConfig('consentManagement');
const consentManagement = ortb2Data.consentManagement || {};
const coppa = config.getConfig('coppa');
if (consentManagement && !!(consentManagement.gdpr)) {
deepSetValue(regs, 'gdpr_applies', !!consentManagement.gdpr);
Expand Down
10 changes: 7 additions & 3 deletions modules/apstreamBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,17 @@ function getRawConsentString(gdprConsentConfig) {
return gdprConsentConfig.consentString;
}

function getConsentStringFromPrebid(gdprConsentConfig) {
function getConsentStringFromPrebid(bidderRequest) {
const { gdprConsentConfig } = bidderRequest;
const consentString = getRawConsentString(gdprConsentConfig);
if (!consentString) {
return null;
}

let isIab = config.getConfig('consentManagement.cmpApi') != 'static';
const ortb2Data = bidderRequest?.ortb2 || {};
const consentManagement = ortb2Data?.consentManagement || {};

let isIab = consentManagement?.cmpApi != 'static';
let vendorConsents = (
gdprConsentConfig.vendorData.vendorConsents ||
(gdprConsentConfig.vendorData.vendor || {}).consents ||
Expand All @@ -305,7 +309,7 @@ function getConsentStringFromPrebid(gdprConsentConfig) {

function getIabConsentString(bidderRequest) {
if (deepAccess(bidderRequest, 'gdprConsent')) {
return getConsentStringFromPrebid(bidderRequest.gdprConsent);
return getConsentStringFromPrebid(bidderRequest);
}

return 'disabled';
Expand Down
8 changes: 5 additions & 3 deletions modules/insticatorBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ function buildImpression(bidRequest) {
return imp;
}

function buildDevice() {
const deviceConfig = config.getConfig('device');
function buildDevice(bidRequest) {
const ortb2Data = bidRequest?.ortb2 || {};
const deviceConfig = ortb2Data?.device || {}

const device = {
w: window.innerWidth,
h: window.innerHeight,
Expand Down Expand Up @@ -184,7 +186,7 @@ function buildRequest(validBidRequests, bidderRequest) {
page: bidderRequest.refererInfo.page,
ref: bidderRequest.refererInfo.ref,
},
device: buildDevice(),
device: buildDevice(bidderRequest),
regs: buildRegs(bidderRequest),
user: buildUser(validBidRequests[0]),
imp: validBidRequests.map((bidRequest) => buildImpression(bidRequest)),
Expand Down
6 changes: 4 additions & 2 deletions modules/madvertiseBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { parseSizesInput, _each } from '../src/utils.js';
import {config} from '../src/config.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';

// use protocol relative urls for http or https
Expand Down Expand Up @@ -34,6 +33,9 @@ export const spec = {
* @return ServerRequest[]
*/
buildRequests: function (bidRequests, bidderRequest) {
const ortb2Data = bidderRequest?.ortb2 || {};
const consentManagement = ortb2Data?.consentManagement || {};

return bidRequests.map(bidRequest => {
bidRequest.startTime = new Date().getTime();

Expand All @@ -53,7 +55,7 @@ export const spec = {
}

if (bidderRequest && bidderRequest.gdprConsent) {
src = src + '&gdpr=' + (bidderRequest.gdprConsent.gdprApplies ? '1' : '0') + '&consent[0][format]=' + config.getConfig('consentManagement.cmpApi') + '&consent[0][value]=' + bidderRequest.gdprConsent.consentString;
src = src + '&gdpr=' + (bidderRequest.gdprConsent.gdprApplies ? '1' : '0') + '&consent[0][format]=' + consentManagement?.cmpApi + '&consent[0][value]=' + bidderRequest.gdprConsent.consentString;
}

return {
Expand Down