From 4ff8897d0d83c9332b27580e7abfa60b4e199f69 Mon Sep 17 00:00:00 2001 From: Tal Avital Date: Thu, 8 Jan 2026 13:12:44 +0200 Subject: [PATCH 1/2] support y limited ads logic --- modules/taboolaBidAdapter.js | 23 ++++-- test/spec/modules/taboolaBidAdapter_spec.js | 88 +++++++++++++++++++++ 2 files changed, 103 insertions(+), 8 deletions(-) diff --git a/modules/taboolaBidAdapter.js b/modules/taboolaBidAdapter.js index ecc450ca2a5..87375690e1c 100644 --- a/modules/taboolaBidAdapter.js +++ b/modules/taboolaBidAdapter.js @@ -410,15 +410,22 @@ function fillTaboolaReqData(bidderRequest, bidRequest, data, context) { ext: getDeviceExtSignals(ortb2Device.ext) }; deepSetValue(data, 'device', device); - const extractedUserId = userData.getUserId(gdprConsent, uspConsent); - if (data.user === undefined || data.user === null) { - data.user = { - buyeruid: 0, - ext: {} + + const isDNT = ortb2Device.dnt === 1; + + if (isDNT) { + data.user = {}; + } else { + const extractedUserId = userData.getUserId(gdprConsent, uspConsent); + if (data.user === undefined || data.user === null) { + data.user = { + buyeruid: 0, + ext: {} + } + } + if (extractedUserId && extractedUserId !== 0) { + deepSetValue(data, 'user.buyeruid', extractedUserId); } - } - if (extractedUserId && extractedUserId !== 0) { - deepSetValue(data, 'user.buyeruid', extractedUserId); } if (data.regs?.ext === undefined || data.regs?.ext === null) { data.regs = { diff --git a/test/spec/modules/taboolaBidAdapter_spec.js b/test/spec/modules/taboolaBidAdapter_spec.js index 8aaff32c380..ff5e70997c8 100644 --- a/test/spec/modules/taboolaBidAdapter_spec.js +++ b/test/spec/modules/taboolaBidAdapter_spec.js @@ -603,6 +603,94 @@ describe('Taboola Adapter', function () { config.resetConfig() }); + + it('should strip user identifiers when DNT is enabled', function () { + getDataFromLocalStorage.returns(51525152); + hasLocalStorage.returns(true); + localStorageIsEnabled.returns(true); + + const bidderRequest = { + ...commonBidderRequest, + ortb2: { + device: { + dnt: 1, + ua: navigator.userAgent + }, + user: { + id: 'ortb2UserId', + buyeruid: 'ortb2BuyerUid', + ext: { + eids: [{source: 'test', uids: [{id: 'testId'}]}] + } + } + } + }; + + const res = spec.buildRequests([defaultBidRequest], bidderRequest); + expect(res.data.user).to.deep.equal({}); + expect(res.data.user.buyeruid).to.be.undefined; + expect(res.data.user.id).to.be.undefined; + expect(res.data.user.ext).to.be.undefined; + }); + + it('should still pass GDPR consent when DNT is enabled', function () { + const bidderRequest = { + ...commonBidderRequest, + ortb2: { + device: { + dnt: 1, + ua: navigator.userAgent + } + }, + gdprConsent: { + gdprApplies: true, + consentString: 'gdprConsentString', + } + }; + + const res = spec.buildRequests([defaultBidRequest], bidderRequest); + expect(res.data.user.ext.consent).to.equal('gdprConsentString'); + expect(res.data.regs.ext.gdpr).to.equal(1); + expect(res.data.user.buyeruid).to.be.undefined; + expect(res.data.user.id).to.be.undefined; + }); + + it('should pass user identifiers when DNT is not enabled', function () { + getDataFromLocalStorage.returns(51525152); + hasLocalStorage.returns(true); + localStorageIsEnabled.returns(true); + + const bidderRequest = { + ...commonBidderRequest, + ortb2: { + device: { + dnt: 0, + ua: navigator.userAgent + } + } + }; + + const res = spec.buildRequests([defaultBidRequest], bidderRequest); + expect(res.data.user.buyeruid).to.equal(51525152); + }); + + it('should pass user identifiers when DNT is not set', function () { + getDataFromLocalStorage.returns(51525152); + hasLocalStorage.returns(true); + localStorageIsEnabled.returns(true); + + const bidderRequest = { + ...commonBidderRequest, + ortb2: { + device: { + ua: navigator.userAgent + } + } + }; + + const res = spec.buildRequests([defaultBidRequest], bidderRequest); + expect(res.data.user.buyeruid).to.equal(51525152); + }); }) describe('handle userid ', function () { From 3caa94e7deaf46903b8803557d51e6ce2ce23953 Mon Sep 17 00:00:00 2001 From: Tal Avital Date: Mon, 12 Jan 2026 15:37:31 +0200 Subject: [PATCH 2/2] add ifa to dnt logic --- modules/taboolaBidAdapter.js | 1 + test/spec/modules/taboolaBidAdapter_spec.js | 33 +++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/modules/taboolaBidAdapter.js b/modules/taboolaBidAdapter.js index 87375690e1c..a52262cfc88 100644 --- a/modules/taboolaBidAdapter.js +++ b/modules/taboolaBidAdapter.js @@ -415,6 +415,7 @@ function fillTaboolaReqData(bidderRequest, bidRequest, data, context) { if (isDNT) { data.user = {}; + delete data.device.ifa; } else { const extractedUserId = userData.getUserId(gdprConsent, uspConsent); if (data.user === undefined || data.user === null) { diff --git a/test/spec/modules/taboolaBidAdapter_spec.js b/test/spec/modules/taboolaBidAdapter_spec.js index ff5e70997c8..8dadadc7102 100644 --- a/test/spec/modules/taboolaBidAdapter_spec.js +++ b/test/spec/modules/taboolaBidAdapter_spec.js @@ -633,6 +633,39 @@ describe('Taboola Adapter', function () { expect(res.data.user.ext).to.be.undefined; }); + it('should strip device.ifa when DNT is enabled', function () { + const bidderRequest = { + ...commonBidderRequest, + ortb2: { + device: { + dnt: 1, + ua: navigator.userAgent, + ifa: 'test-ifa-identifier' + } + } + }; + + const res = spec.buildRequests([defaultBidRequest], bidderRequest); + expect(res.data.device.ifa).to.be.undefined; + expect(res.data.device.dnt).to.equal(1); + }); + + it('should preserve device.ifa when DNT is not enabled', function () { + const bidderRequest = { + ...commonBidderRequest, + ortb2: { + device: { + dnt: 0, + ua: navigator.userAgent, + ifa: 'test-ifa-identifier' + } + } + }; + + const res = spec.buildRequests([defaultBidRequest], bidderRequest); + expect(res.data.device.ifa).to.equal('test-ifa-identifier'); + }); + it('should still pass GDPR consent when DNT is enabled', function () { const bidderRequest = { ...commonBidderRequest,