From 5a1ebad99a685211db913eb60364d2ba16c4aa7c Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Mon, 2 Oct 2023 08:35:24 -0400 Subject: [PATCH] Sharethrough Bid Adapter: revise getUserSyncs method (#10556) * Update sharethroughBidAdapter.js * Removing GDPR and GPP query-string params from userSync url creation as our ad-server team gets this info from the bid request sent earlier. * Update Sharethrough bid adapter and spec * Further updating `sharethroughBidAdapter.js` to remove now-unneeded params from `getUserSyncs()` method. * Updating spec file to remove no-longer-necc tests for query params in getUserSync url. --- modules/sharethroughBidAdapter.js | 21 +++------------ .../modules/sharethroughBidAdapter_spec.js | 27 +++---------------- 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/modules/sharethroughBidAdapter.js b/modules/sharethroughBidAdapter.js index a8beb018b73..3684e793dcb 100644 --- a/modules/sharethroughBidAdapter.js +++ b/modules/sharethroughBidAdapter.js @@ -216,26 +216,13 @@ export const sharethroughAdapterSpec = { }); }, - getUserSyncs: (syncOptions, serverResponses, gdprConsent, gppConsent) => { + getUserSyncs: (syncOptions, serverResponses) => { const shouldCookieSync = syncOptions.pixelEnabled && deepAccess(serverResponses, '0.body.cookieSyncUrls') !== undefined; - let syncurl = ''; - - // Attaching GDPR Consent Params in UserSync url - if (gdprConsent) { - syncurl += '&gdpr=' + (gdprConsent.gdprApplies ? 1 : 0); - syncurl += '&gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || ''); - } - if (gppConsent) { - syncurl += '&gpp=' + encodeURIComponent(gppConsent?.gppString); - syncurl += '&gpp_sid=' + encodeURIComponent(gppConsent?.applicableSections?.join(',')); - } - - return shouldCookieSync ? serverResponses[0].body.cookieSyncUrls.map((url) => ( - { type: 'image', - url: url + syncurl - })) : []; + return shouldCookieSync + ? serverResponses[0].body.cookieSyncUrls.map((url) => ({ type: 'image', url: url })) + : []; }, // Empty implementation for prebid core to be able to find it diff --git a/test/spec/modules/sharethroughBidAdapter_spec.js b/test/spec/modules/sharethroughBidAdapter_spec.js index 68bf14ae9c1..eb0b45dda11 100644 --- a/test/spec/modules/sharethroughBidAdapter_spec.js +++ b/test/spec/modules/sharethroughBidAdapter_spec.js @@ -409,12 +409,12 @@ describe('sharethrough adapter spec', function () { it('should properly attach GPP information to the request when applicable', () => { bidderRequest.gppConsent = { gppString: 'some-gpp-string', - applicableSections: [3, 5] + applicableSections: [3, 5], }; const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data; - expect(openRtbReq.regs.gpp).to.equal(bidderRequest.gppConsent.gppString) - expect(openRtbReq.regs.gpp_sid).to.equal(bidderRequest.gppConsent.applicableSections) + expect(openRtbReq.regs.gpp).to.equal(bidderRequest.gppConsent.gppString); + expect(openRtbReq.regs.gpp_sid).to.equal(bidderRequest.gppConsent.applicableSections); }); it('should populate request accordingly when gpp explicitly does not apply', function () { @@ -618,7 +618,7 @@ describe('sharethrough adapter spec', function () { badv: ['domain1.com', 'domain2.com'], regs: { gpp: 'gpp_string', - gpp_sid: [7] + gpp_sid: [7], }, }; @@ -870,25 +870,6 @@ describe('sharethrough adapter spec', function () { const syncArray = spec.getUserSyncs({ pixelEnabled: false }, serverResponses); expect(syncArray).to.be.an('array').that.is.empty; }); - - it('returns GDPR Consent Params in UserSync url', function () { - const syncArray = spec.getUserSyncs({ pixelEnabled: true }, serverResponses, { gdprApplies: true, - consentString: 'consent' }); - expect(syncArray).to.deep.equal([ - { type: 'image', url: 'cookieUrl1&gdpr=1&gdpr_consent=consent' }, - { type: 'image', url: 'cookieUrl2&gdpr=1&gdpr_consent=consent' }, - { type: 'image', url: 'cookieUrl3&gdpr=1&gdpr_consent=consent' }, - ]); - }); - - it('returns GPP Consent Params in UserSync url', function () { - const syncArray = spec.getUserSyncs({ pixelEnabled: true }, serverResponses, {}, {gppString: 'gpp-string', applicableSections: [1, 2]}); - expect(syncArray).to.deep.equal([ - { type: 'image', url: 'cookieUrl1&gdpr=0&gdpr_consent=&gpp=gpp-string&gpp_sid=1%2C2' }, - { type: 'image', url: 'cookieUrl2&gdpr=0&gdpr_consent=&gpp=gpp-string&gpp_sid=1%2C2' }, - { type: 'image', url: 'cookieUrl3&gdpr=0&gdpr_consent=&gpp=gpp-string&gpp_sid=1%2C2' }, - ]); - }); }); }); });