Skip to content

Commit

Permalink
TripleLift: CCPA legacy support (prebid#4641)
Browse files Browse the repository at this point in the history
* Add CCPA query param

* Simplify check for usPrivacy argument
  • Loading branch information
davidwoodsandersen authored and jsnellbaker committed Dec 18, 2019
1 parent f799046 commit 094d921
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
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/);
});
});
});

0 comments on commit 094d921

Please sign in to comment.