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

EMX: Add CCPA Suport #147

Merged
merged 3 commits into from
Feb 28, 2020
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
3 changes: 3 additions & 0 deletions emx-digital/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# 1.1.0
- Adds support for CCPA (US Privacy)

# 1.0.0
- Bidder added to support latest EMX Exchange.
9 changes: 8 additions & 1 deletion emx-digital/emx-digital-htb-system-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ function validateTargetingWithDeal(targetingMap) {
}));
}

function validateBidRequestWithPrivacy(request) {
var req = JSON.parse(request.body);
expect(req.regs.ext.gdpr).toBe(1);
expect(req.user.ext.consent).toBe('TEST_GDPR_CONSENT_STRING');
}

function getPassResponse(request) {
var response = { request: request };

Expand All @@ -203,5 +209,6 @@ module.exports = {
getValidResponse: getValidResponse,
getPassResponse: getPassResponse,
getValidResponseWithDeal: getValidResponseWithDeal,
validateTargetingWithDeal: validateTargetingWithDeal
validateTargetingWithDeal: validateTargetingWithDeal,
validateBidRequestWithPrivacy: validateBidRequestWithPrivacy
};
14 changes: 10 additions & 4 deletions emx-digital/emx-digital-htb.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function BRealTimeHtb(configs) {
*/
function __generateRequestObj(returnParcels) {
var timeout = SpaceCamp.globalTimeout || 1500;
var version = '1.0.0';
var version = '1.1.0';

var timestamp = System.now();
var baseUrl = Browser.getProtocol() + __endpoint + ('?t=' + timeout + '&ts=' + timestamp);
Expand All @@ -102,8 +102,9 @@ function BRealTimeHtb(configs) {
var pageUrl = Browser.getPageUrl();
var pageHost = Browser.getHostname();
var callbackId = System.generateUniqueId();
var privacyEnabled = ComplianceService.isPrivacyEnabled();
var gdprStatus = ComplianceService.gdpr.getConsent();
var gdprPrivacyEnabled = ComplianceService.isPrivacyEnabled();
var ccpaStatus = ComplianceService.usp && ComplianceService.usp.getConsent();

/* =============================================================================
* STEP 2 | Generate Request URL
Expand Down Expand Up @@ -151,7 +152,7 @@ function BRealTimeHtb(configs) {
}
};

if (gdprPrivacyEnabled) {
if (privacyEnabled) {
/* eslint-disable camelcase */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all lint disables, and fix the linting issues ...

if (gdprStatus.hasOwnProperty('consentString')) {
__emxData.user = {
Expand All @@ -160,7 +161,6 @@ function BRealTimeHtb(configs) {
}
};
}
/* eslint-enable camelcase */

if (gdprStatus.hasOwnProperty('applies')) {
__emxData.regs = {
Expand All @@ -169,6 +169,12 @@ function BRealTimeHtb(configs) {
}
};
}

if (ccpaStatus && ccpaStatus.hasOwnProperty('uspString')) {
__emxData.us_privacy = ccpaStatus.uspString;
}

/* eslint-enable camelcase */
}

/* -------------------------------------------------------------------------- */
Expand Down