Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions spec/src/modules/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the .only here

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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also check the value of the property here?

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);
Expand All @@ -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();
});

Expand Down
2 changes: 2 additions & 0 deletions src/constructorio.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class ConstructorIO {
idOptions,
beaconMode,
networkParameters,
constructorABCell,
} = options;

if (!apiKey || typeof apiKey !== 'string') {
Expand Down Expand Up @@ -114,6 +115,7 @@ class ConstructorIO {
sendTrackingEvents,
sendReferrerWithTrackingEvents,
eventDispatcher,
constructorABCell,
beaconMode: (beaconMode === false) ? false : true, // Defaults to 'true',
networkParameters: networkParameters || {},
};
Expand Down
5 changes: 5 additions & 0 deletions src/modules/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ function applyParams(parameters, options) {
testCells,
requestMethod,
beaconMode,
constructorABCell,
} = options;
const { host, pathname } = helpers.getWindowLocation();
const sendReferrerWithTrackingEvents = (options.sendReferrerWithTrackingEvents === false)
? false
: true; // Defaults to 'true'
let aggregateParams = Object.assign(parameters);

if (typeof constructorABCell === 'boolean') {
aggregateParams.is_constructor_ab_cell = constructorABCell;
}

if (version) {
aggregateParams.c = version;
}
Expand Down