diff --git a/spec/src/modules/tracker.js b/spec/src/modules/tracker.js index 924e7e03..a96661c8 100644 --- a/spec/src/modules/tracker.js +++ b/spec/src/modules/tracker.js @@ -68,20 +68,21 @@ describe(`ConstructorIO - Tracker${bundledDescriptionSuffix}`, () => { }); describe('trackSessionStart', () => { - it('Should respond with a valid response', (done) => { + it.only('Should respond with a valid response', (done) => { const { tracker } = new ConstructorIO({ apiKey: testApiKey, fetch: fetchSpy, + constructorABCell: true, ...requestQueueOptions, }); tracker.on('success', (responseParams) => { const requestParams = helpers.extractUrlParamsFromFetch(fetchSpy); - // Request expect(fetchSpy).to.have.been.called; expect(requestParams).to.have.property('key'); expect(requestParams).to.have.property('i'); + expect(requestParams).to.have.property('is_constructor_ab_cell'); expect(requestParams).to.have.property('s'); expect(requestParams).to.have.property('action').to.equal('session_start'); expect(requestParams).to.have.property('c').to.equal(clientVersion); @@ -91,7 +92,6 @@ describe(`ConstructorIO - Tracker${bundledDescriptionSuffix}`, () => { // Response expect(responseParams).to.have.property('method').to.equal('GET'); expect(responseParams).to.have.property('message').to.equal('ok'); - done(); }); diff --git a/src/constructorio.js b/src/constructorio.js index 1503f476..887c00da 100644 --- a/src/constructorio.js +++ b/src/constructorio.js @@ -75,6 +75,7 @@ class ConstructorIO { idOptions, beaconMode, networkParameters, + constructorABCell, } = options; if (!apiKey || typeof apiKey !== 'string') { @@ -114,6 +115,7 @@ class ConstructorIO { sendTrackingEvents, sendReferrerWithTrackingEvents, eventDispatcher, + constructorABCell, beaconMode: (beaconMode === false) ? false : true, // Defaults to 'true', networkParameters: networkParameters || {}, }; diff --git a/src/modules/tracker.js b/src/modules/tracker.js index 22a26e6d..3c288a4c 100644 --- a/src/modules/tracker.js +++ b/src/modules/tracker.js @@ -15,6 +15,7 @@ function applyParams(parameters, options) { testCells, requestMethod, beaconMode, + constructorABCell, } = options; const { host, pathname } = helpers.getWindowLocation(); const sendReferrerWithTrackingEvents = (options.sendReferrerWithTrackingEvents === false) @@ -22,6 +23,10 @@ function applyParams(parameters, options) { : true; // Defaults to 'true' let aggregateParams = Object.assign(parameters); + if (typeof constructorABCell === 'boolean') { + aggregateParams.is_constructor_ab_cell = constructorABCell; + } + if (version) { aggregateParams.c = version; }