Skip to content

Commit

Permalink
Medianet: CCPA support added (prebid#4573)
Browse files Browse the repository at this point in the history
  • Loading branch information
vedantseta authored and tadam75 committed Jan 9, 2020
1 parent 3eb4d32 commit 920cfb1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/medianetBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function getCoordinates(id) {
return null;
}

function extParams(params, gdpr) {
function extParams(params, gdpr, uspConsent) {
let ext = {
customer_id: params.cid,
prebid_version: $$PREBID_GLOBAL$$.version
Expand All @@ -141,10 +141,17 @@ function extParams(params, gdpr) {
if (ext.gdpr_applies) {
ext.gdpr_consent_string = gdpr.consentString || '';
}

ext.usp_applies = !!(uspConsent);
if (ext.usp_applies) {
ext.usp_consent_string = uspConsent || '';
}

let windowSize = spec.getWindowSize();
if (windowSize.w !== -1 && windowSize.h !== -1) {
ext.screen = windowSize;
}

return ext;
}

Expand Down Expand Up @@ -240,7 +247,7 @@ function normalizeCoordinates(coordinates) {
function generatePayload(bidRequests, bidderRequests) {
return {
site: siteDetails(bidRequests[0].params.site),
ext: extParams(bidRequests[0].params, bidderRequests.gdprConsent),
ext: extParams(bidRequests[0].params, bidderRequests.gdprConsent, bidderRequests.uspConsent),
id: bidRequests[0].auctionId,
imp: bidRequests.map(request => slotParams(request)),
tmax: bidderRequests.timeout || config.getConfig('bidderTimeout')
Expand Down
7 changes: 7 additions & 0 deletions test/spec/modules/medianetBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ let VALID_BID_REQUEST = [{
'customer_id': 'customer_id',
'prebid_version': $$PREBID_GLOBAL$$.version,
'gdpr_applies': false,
'usp_applies': false,
'screen': {
'w': 1000,
'h': 1000
Expand Down Expand Up @@ -345,6 +346,7 @@ let VALID_BID_REQUEST = [{
'customer_id': 'customer_id',
'prebid_version': $$PREBID_GLOBAL$$.version,
'gdpr_applies': false,
'usp_applies': false,
'screen': {
'w': 1000,
'h': 1000
Expand Down Expand Up @@ -429,6 +431,7 @@ let VALID_BID_REQUEST = [{
'customer_id': 'customer_id',
'prebid_version': $$PREBID_GLOBAL$$.version,
'gdpr_applies': false,
'usp_applies': false,
'screen': {
'w': 1000,
'h': 1000
Expand Down Expand Up @@ -511,6 +514,7 @@ let VALID_BID_REQUEST = [{
'customer_id': 'customer_id',
'prebid_version': $$PREBID_GLOBAL$$.version,
'gdpr_applies': false,
'usp_applies': false,
'screen': {
'w': 1000,
'h': 1000
Expand Down Expand Up @@ -830,6 +834,7 @@ let VALID_BID_REQUEST = [{
'consentString': 'consentString',
'gdprApplies': true,
},
'uspConsent': '1NYN',
'timeout': 3000,
refererInfo: {
referer: 'http://media.net/prebidtest',
Expand All @@ -850,6 +855,8 @@ let VALID_BID_REQUEST = [{
'prebid_version': $$PREBID_GLOBAL$$.version,
'gdpr_consent_string': 'consentString',
'gdpr_applies': true,
'usp_applies': true,
'usp_consent_string': '1NYN',
'screen': {
'w': 1000,
'h': 1000
Expand Down

0 comments on commit 920cfb1

Please sign in to comment.