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

TripleLift: CCPA support #4628

Merged
merged 15 commits into from
Dec 18, 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
10 changes: 9 additions & 1 deletion modules/tripleliftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export const tripleliftAdapterSpec = {
}
}

if (bidderRequest && bidderRequest.uspConsent) {
tlCall = utils.tryAppendQueryString(tlCall, 'us_privacy', bidderRequest.uspConsent);
}

if (tlCall.lastIndexOf('&') === tlCall.length - 1) {
tlCall = tlCall.substring(0, tlCall.length - 1);
}
Expand All @@ -62,7 +66,7 @@ export const tripleliftAdapterSpec = {
});
},

getUserSyncs: function(syncOptions) {
getUserSyncs: function(syncOptions, responses, gdprConsent, usPrivacy) {
let syncType = _getSyncType(syncOptions);
if (!syncType) return;

Expand All @@ -78,6 +82,10 @@ export const tripleliftAdapterSpec = {
syncEndpoint = utils.tryAppendQueryString(syncEndpoint, 'cmp_cs', consentString);
}

if (usPrivacy) {
syncEndpoint = utils.tryAppendQueryString(syncEndpoint, 'us_privacy', usPrivacy);
}

return [{
type: syncType,
url: syncEndpoint
Expand Down
13 changes: 13 additions & 0 deletions test/spec/modules/tripleliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ describe('triplelift adapter', function () {
expect(url).to.match(new RegExp('(?:' + prebid.version + ')'))
expect(url).to.match(/(?:referrer)/);
});
it('should return us_privacy param when CCPA info is available', function() {
bidderRequest.uspConsent = '1YYY';
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
const url = request.url;
expect(url).to.match(/(\?|&)us_privacy=1YYY/);
});
it('should return schain when present', function() {
const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
const { data: payload } = request;
Expand Down Expand Up @@ -401,5 +407,12 @@ describe('triplelift adapter', function () {
expect(result[0].type).to.equal('iframe');
expect(result[0].url).to.equal(expectedIframeSyncUrl);
});
it('sends us_privacy param when info is available', function() {
let syncOptions = {
iframeEnabled: true
};
let result = tripleliftAdapterSpec.getUserSyncs(syncOptions, null, null, '1YYY');
expect(result[0].url).to.match(/(\?|&)us_privacy=1YYY/);
});
});
});