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

Media.net: CCPA (USP) support added #4573

Merged
merged 1 commit into from
Dec 16, 2019
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
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