Skip to content

Commit

Permalink
GPP support for the yahoo connect id module. (prebid#9399)
Browse files Browse the repository at this point in the history
Co-authored-by: dumitrubarbos <dumitru-radu.barbos@yahooinc.com>
  • Loading branch information
2 people authored and jorgeluisrocha committed May 18, 2023
1 parent 685007e commit adc1920
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
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

0 comments on commit adc1920

Please sign in to comment.