diff --git a/modules/intentIqIdSystem.ts b/modules/intentIqIdSystem.ts index ed78652ecb2..f5b40ded326 100644 --- a/modules/intentIqIdSystem.ts +++ b/modules/intentIqIdSystem.ts @@ -474,11 +474,16 @@ export const intentIqIdSubmodule = { const cmpData = getCmpData(); const gdprDetected = cmpData.gdprString; firstPartyData = tryParse(readData(FIRST_PARTY_KEY_FINAL, allowedStorage) as string); - actualABGroup = defineABTestingGroup(configParams, partnerData?.terminationCause); - if (groupChanged) groupChanged(actualABGroup, partnerData?.terminationCause); const currentBrowserLowerCase = detectBrowser(); const browserBlackList = typeof configParams.browserBlackList === 'string' ? configParams.browserBlackList.toLowerCase() : ''; const isBlacklisted = browserBlackList?.includes(currentBrowserLowerCase); + + if (!isBlacklisted) { + actualABGroup = defineABTestingGroup(configParams, partnerData?.terminationCause); + if (groupChanged) groupChanged(actualABGroup, partnerData?.terminationCause); + } else { + actualABGroup = undefined; + } let newUser = false; setGamReporting(gamObjectReference, gamParameterName, actualABGroup, isBlacklisted); diff --git a/test/spec/modules/intentIqIdSystem_spec.js b/test/spec/modules/intentIqIdSystem_spec.js index 279fd9cc5bb..c1e01ef9439 100644 --- a/test/spec/modules/intentIqIdSystem_spec.js +++ b/test/spec/modules/intentIqIdSystem_spec.js @@ -2029,6 +2029,79 @@ describe('IntentIQ tests', function () { expect(groupChangedSpy.calledWith(usedGroup)).to.be.true; }); + it('should NOT call groupChanged when the current browser is blacklisted', async function () { + const groupChangedSpy = sinon.spy(); + const blk = detectBrowser(); + const configParams = { + params: { + ...defaultConfigParams.params, + browserBlackList: blk, + groupChanged: groupChangedSpy + } + }; + + intentIqIdSubmodule.getId(configParams); + await waitForClientHints(); + + expect(groupChangedSpy.called).to.be.false; + }); + + it('should not mark a test group on the sync pixel when the current browser is blacklisted', async function () { + const blk = detectBrowser(); + const configParams = { + params: { + ...defaultConfigParams.params, + browserBlackList: blk + } + }; + + intentIqIdSubmodule.getId(configParams); + await waitForClientHints(); + + const pixelRequest = server.requests[0]; + expect(pixelRequest).to.exist; + expect(pixelRequest.url).to.include('at=20'); + expect(pixelRequest.url).to.not.include('testGroup='); + expect(pixelRequest.url).to.include('isInTestGroup=false'); + }); + + + it('should NOT call groupChanged when the current browser is blacklisted', async function () { + const groupChangedSpy = sinon.spy(); + const blk = detectBrowser(); + const configParams = { + params: { + ...defaultConfigParams.params, + browserBlackList: blk, + groupChanged: groupChangedSpy + } + }; + + intentIqIdSubmodule.getId(configParams); + await waitForClientHints(); + + expect(groupChangedSpy.called).to.be.false; + }); + + it('should not mark a test group on the sync pixel when the current browser is blacklisted', async function () { + const blk = detectBrowser(); + const configParams = { + params: { + ...defaultConfigParams.params, + browserBlackList: blk + } + }; + + intentIqIdSubmodule.getId(configParams); + await waitForClientHints(); + + const pixelRequest = server.requests[0]; + expect(pixelRequest).to.exist; + expect(pixelRequest.url).to.include('at=20'); + expect(pixelRequest.url).to.not.include('testGroup='); + expect(pixelRequest.url).to.include('isInTestGroup=false'); + }); + it('should include testPercentage with configured abPercentage in AT=39 URL', async function () { const callBackSpy = sinon.spy(); const configParams = {