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

KueezRtb Bid Adapter: pass gpp consent to userSync server. #10306

Merged
merged 2 commits into from
Aug 21, 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
11 changes: 9 additions & 2 deletions modules/kueezRtbBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,20 @@ function interpretResponse(serverResponse, request) {
}
}

function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '') {
function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '', gppConsent = {}) {
let syncs = [];
const {iframeEnabled, pixelEnabled} = syncOptions;
const {gdprApplies, consentString = ''} = gdprConsent;
const {gppString, applicableSections} = gppConsent;

const cidArr = responses.filter(resp => deepAccess(resp, 'body.cid')).map(resp => resp.body.cid).filter(uniques);
const params = `?cid=${encodeURIComponent(cidArr.join(','))}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${encodeURIComponent(consentString || '')}&us_privacy=${encodeURIComponent(uspConsent || '')}`
let params = `?cid=${encodeURIComponent(cidArr.join(','))}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${encodeURIComponent(consentString || '')}&us_privacy=${encodeURIComponent(uspConsent || '')}`

if (gppString && applicableSections?.length) {
params += '&gpp=' + encodeURIComponent(gppString);
params += '&gpp_sid=' + encodeURIComponent(applicableSections.join(','));
}

if (iframeEnabled) {
syncs.push({
type: 'iframe',
Expand Down
21 changes: 20 additions & 1 deletion test/spec/modules/kueezRtbBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,26 @@ describe('KueezRtbBidAdapter', function () {
'url': 'https://sync.kueezrtb.com/api/sync/image/?cid=testcid123&gdpr=0&gdpr_consent=&us_privacy=',
'type': 'image'
}]);
})
});

it('should generate url with consent data', function () {
const gdprConsent = {
gdprApplies: true,
consentString: 'consent_string'
};
const uspConsent = 'usp_string';
const gppConsent = {
gppString: 'gpp_string',
applicableSections: [7]
}

const result = adapter.getUserSyncs({pixelEnabled: true}, [SERVER_RESPONSE], gdprConsent, uspConsent, gppConsent);

expect(result).to.deep.equal([{
'url': 'https://sync.kueezrtb.com/api/sync/image/?cid=testcid123&gdpr=1&gdpr_consent=consent_string&us_privacy=usp_string&gpp=gpp_string&gpp_sid=7',
'type': 'image'
}]);
});
});

describe('interpret response', function () {
Expand Down