From aa6daf405c2b2da322df409638a7d9269c672a91 Mon Sep 17 00:00:00 2001 From: David Andersen Date: Wed, 18 Dec 2019 13:27:32 -0500 Subject: [PATCH] TripleLift: CCPA support (#4628) * Add IdentityLink support and fix UnifiedId. It appears we've been looking for UnifiedId userIds on the bidderRequest object, when they are found on bidRequests. This commit fixes that error, and adds support for IdentityLink. * change maintainer email to group * TripleLift: Sending schain (#1) * Sending schain * null -> undefined * Hardcode sync endpoint protocol * Switch to EB2 sync endpoint * Add support for image based user syncing * Rename endpoint variable * Add assertion * Add CCPA query param * Simplify check for usPrivacy argument --- modules/tripleliftBidAdapter.js | 10 +++++++++- test/spec/modules/tripleliftBidAdapter_spec.js | 13 +++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 1550a9e3463..7120929059d 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -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); } @@ -62,7 +66,7 @@ export const tripleliftAdapterSpec = { }); }, - getUserSyncs: function(syncOptions) { + getUserSyncs: function(syncOptions, responses, gdprConsent, usPrivacy) { let syncType = _getSyncType(syncOptions); if (!syncType) return; @@ -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 diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 76c549c98ab..17dd64b8deb 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -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; @@ -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/); + }); }); });