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
9 changes: 8 additions & 1 deletion src/amplitude-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,7 @@ AmplitudeClient.prototype._logEvent = function _logEvent(
branch: this.options.plan.branch || undefined,
source: this.options.plan.source || undefined,
version: this.options.plan.version || undefined,
versionId: this.options.plan.versionId || undefined,
};
}

Expand Down Expand Up @@ -1446,7 +1447,13 @@ AmplitudeClient.prototype._logEvent = function _logEvent(
};

const _isObservePlanSet = function _isObservePlanSet(scope) {
return scope.options.plan && (scope.options.plan.source || scope.options.plan.branch || scope.options.plan.version);
return (
scope.options.plan &&
(scope.options.plan.source ||
scope.options.plan.branch ||
scope.options.plan.version ||
scope.options.plan.versionId)
);
};

var _shouldTrackField = function _shouldTrackField(scope, field) {
Expand Down
2 changes: 2 additions & 0 deletions src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { version as libraryVersion } from '../package.json';
* @property {string} [plan.branch] The tracking plan branch name e.g. "main"
* @property {string} [plan.source] The tracking plan source e.g. "web"
* @property {string} [plan.version] The tracking plan version e.g. "1", "15"
* @property {string} [plan.versionId] The tracking plan version Id e.g. "9ec23ba0-275f-468f-80d1-66b88bff9529"
* @property {string} [platform=`Web`] - Platform device is running on. Defaults to `Web` (browser, including mobile browsers).
* @property {number} [savedMaxCount=`1000`] - Maximum number of events to save in localStorage. If more events are logged while offline, then old events are removed.
* @property {boolean} [saveEvents=`true`] - If `true`, saves events to localStorage and removes them upon successful upload. *Note: Without saving events, events may be lost if the user navigates to another page before the events are uploaded.*
Expand Down Expand Up @@ -87,6 +88,7 @@ export default {
branch: '',
source: '',
version: '',
versionId: '',
},
platform: 'Web',
savedMaxCount: 1000,
Expand Down
1 change: 1 addition & 0 deletions test/amplitude-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ describe('AmplitudeClient', function () {
branch: 'my-feature-branch',
source: 'web',
version: '1.0.0',
versionId: '9ec23ba0-275f-468f-80d1-66b88bff9529',
};
amplitude.init(apiKey, null, { plan: plan });

Expand Down