Skip to content
Merged
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
2 changes: 2 additions & 0 deletions spec/src/modules/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,7 @@ describe(`ConstructorIO - Tracker${bundledDescriptionSuffix}`, () => {
const optionalParameters = {
groupId: 'group-id',
displayName: 'display-name',
analyticsTags: testAnalyticsTag,
};

it('Backwards Compatibility - V2 Should respond with a valid response when term and snake cased parameters are provided', (done) => {
Expand Down Expand Up @@ -1750,6 +1751,7 @@ describe(`ConstructorIO - Tracker${bundledDescriptionSuffix}`, () => {
group_id: optionalParameters.groupId,
display_name: optionalParameters.displayName,
});
expect(requestParams).to.have.property('analytics_tags').to.deep.equal(testAnalyticsTag);

// Response
expect(responseParams).to.have.property('method').to.equal('GET');
Expand Down
6 changes: 6 additions & 0 deletions src/modules/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ class Tracker {
* @param {string} parameters.originalQuery - The current autocomplete search query
* @param {string} [parameters.groupId] - Group identifier of the group to search within. Only required if searching within a group, i.e. "Pumpkin in Canned Goods"
* @param {string} [parameters.displayName] - Display name of group of selected item
* @param {object} [parameters.analyticsTags] - Pass additional analytics data
* @param {object} [networkParameters] - Parameters relevant to the network request
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
* @returns {(true|Error)}
Expand Down Expand Up @@ -621,6 +622,7 @@ class Tracker {
groupId = group_id,
display_name,
displayName = display_name,
analyticsTags,
} = parameters;

if (originalQuery) {
Expand All @@ -634,6 +636,10 @@ class Tracker {
};
}

if (analyticsTags) {
queryParams.analytics_tags = analyticsTags;
}

this.requests.queue(`${url}${applyParamsAsString(queryParams, this.options)}`, undefined, undefined, networkParameters);
this.requests.send();

Expand Down
Loading