diff --git a/modules/inskinBidAdapter.js b/modules/inskinBidAdapter.js index a89a1b20219..2a55b5280db 100644 --- a/modules/inskinBidAdapter.js +++ b/modules/inskinBidAdapter.js @@ -57,6 +57,9 @@ export const spec = { parallel: true }, validBidRequests[0].params); + data.keywords = data.keywords || []; + const restrictions = []; + if (bidderRequest && bidderRequest.gdprConsent) { data.consent = { gdprVendorId: 150, @@ -64,6 +67,33 @@ export const spec = { // will check if the gdprApplies field was populated with a boolean value (ie from page config). If it's undefined, then default to true gdprConsentRequired: (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : true }; + + if (bidderRequest.gdprConsent.apiVersion === 2) { + const purposes = [ + {id: 1, kw: 'nocookies'}, + {id: 2, kw: 'nocontext'}, + {id: 3, kw: 'nodmp'}, + {id: 4, kw: 'nodata'}, + {id: 7, kw: 'noclicks'}, + {id: 9, kw: 'noresearch'} + ]; + + const d = bidderRequest.gdprConsent.vendorData; + + if (d) { + if (d.purposeOneTreatment) { + data.keywords.push('cst-nodisclosure'); + restrictions.push('nodisclosure'); + } + + purposes.map(p => { + if (!checkConsent(p.id, d)) { + data.keywords.push('cst-' + p.kw); + restrictions.push(p.kw); + } + }); + } + } } validBidRequests.map(bid => { @@ -78,6 +108,11 @@ export const spec = { placement.adTypes.push(5, 9, 163, 2163, 3006); + if (restrictions.length) { + placement.properties = placement.properties || {}; + placement.properties.restrictions = restrictions; + } + if (placement.networkId && placement.siteId) { data.placements.push(placement); } @@ -153,6 +188,7 @@ export const spec = { const id = 'ism_tag_' + Math.floor((Math.random() * 10e16)); window[id] = { + plr_AdSlot: e.source.frameElement, bidId: e.data.bidId, bidPrice: bidsMap[e.data.bidId].price, serverResponse @@ -242,4 +278,97 @@ function retrieveAd(bidId, decision) { return "