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

ConnectId: support for GPP parameters #9399

Merged
merged 2 commits into from
Jan 6, 2023
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
16 changes: 15 additions & 1 deletion modules/connectIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ export const connectIdSubmodule = {
us_privacy: consentData && consentData.uspConsent ? consentData.uspConsent : ''
};

if (connectIdSubmodule.isUnderGPPJurisdiction(consentData)) {
data.gpp = consentData.gppConsent.gppString;
data.gpp_sid = encodeURIComponent(consentData.gppConsent.applicableSections.join(','));
}

INPUT_PARAM_KEYS.forEach(key => {
if (typeof params[key] != 'undefined') {
data[key] = params[key];
Expand Down Expand Up @@ -98,14 +103,23 @@ export const connectIdSubmodule = {
},

/**
* Utility function that returns a boolean flag indicating if the opporunity
* Utility function that returns a boolean flag indicating if the opportunity
* is subject to GDPR
* @returns {Boolean}
*/
isEUConsentRequired(consentData) {
return !!(consentData && consentData.gdpr && consentData.gdpr.gdprApplies);
},

/**
* Utility function that returns a boolean flag indicating if the opportunity
* is subject to GPP jurisdiction.
* @returns {Boolean}
*/
isUnderGPPJurisdiction(consentData) {
return !!(consentData && consentData.gppConsent && consentData.gppConsent.gppString);
},

/**
* Utility function that returns a boolean flag indicating if the user
* has opeted out via the Yahoo easy-opt-out mechanism.
Expand Down
22 changes: 17 additions & 5 deletions test/spec/modules/connectIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ describe('Yahoo ConnectID Submodule', () => {
gdprApplies: 1,
consentString: 'GDPR_CONSENT_STRING'
},
uspConsent: 'USP_CONSENT_STRING'
uspConsent: 'USP_CONSENT_STRING',
gppConsent: {
gppString: 'header~section6~section7',
applicableSections: [6, 7]
}
};
});

Expand Down Expand Up @@ -157,7 +161,9 @@ describe('Yahoo ConnectID Submodule', () => {
'1p': '0',
gdpr: '1',
gdpr_consent: consentData.gdpr.consentString,
us_privacy: consentData.uspConsent
us_privacy: consentData.uspConsent,
gpp: consentData.gppConsent.gppString,
gpp_sid: '6%2C7'
};
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);

Expand All @@ -178,7 +184,9 @@ describe('Yahoo ConnectID Submodule', () => {
'1p': '0',
gdpr: '1',
gdpr_consent: consentData.gdpr.consentString,
us_privacy: consentData.uspConsent
us_privacy: consentData.uspConsent,
gpp: consentData.gppConsent.gppString,
gpp_sid: '6%2C7'
};
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);

Expand All @@ -201,7 +209,9 @@ describe('Yahoo ConnectID Submodule', () => {
'1p': '0',
gdpr: '1',
gdpr_consent: consentData.gdpr.consentString,
us_privacy: consentData.uspConsent
us_privacy: consentData.uspConsent,
gpp: consentData.gppConsent.gppString,
gpp_sid: '6%2C7'
};
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);

Expand All @@ -221,7 +231,9 @@ describe('Yahoo ConnectID Submodule', () => {
'1p': '0',
gdpr: '1',
gdpr_consent: consentData.gdpr.consentString,
us_privacy: consentData.uspConsent
us_privacy: consentData.uspConsent,
gpp: consentData.gppConsent.gppString,
gpp_sid: '6%2C7'
};
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);

Expand Down