diff --git a/packages/editor-ui/src/components/Telemetry.vue b/packages/editor-ui/src/components/Telemetry.vue index 83b1464fd9..b700493b68 100644 --- a/packages/editor-ui/src/components/Telemetry.vue +++ b/packages/editor-ui/src/components/Telemetry.vue @@ -33,22 +33,19 @@ export default mixins(externalHooks).extend({ telemetry(): ITelemetrySettings { return this.settingsStore.telemetry; }, + isTelemetryEnabled(): boolean { + return !!this.telemetry?.enabled; + }, }, mounted() { this.init(); }, methods: { init() { - if (this.isTelemetryInitialized || !this.isTelemetryEnabledOnRoute) return; - - const telemetrySettings = this.telemetry; - - if (!telemetrySettings || !telemetrySettings.enabled) { - return; - } + if (this.isTelemetryInitialized || !this.isTelemetryEnabledOnRoute || !this.isTelemetryEnabled) return; this.$telemetry.init( - telemetrySettings, + this.telemetry, { instanceId: this.rootStore.instanceId, userId: this.currentUserId, @@ -69,7 +66,9 @@ export default mixins(externalHooks).extend({ this.init(); }, currentUserId(userId) { - this.$telemetry.identify(this.rootStore.instanceId, userId); + if (this.isTelemetryEnabled) { + this.$telemetry.identify(this.rootStore.instanceId, userId); + } this.$externalHooks().run('telemetry.currentUserIdChanged', { instanceId: this.rootStore.instanceId, userId, diff --git a/packages/editor-ui/src/plugins/telemetry/index.ts b/packages/editor-ui/src/plugins/telemetry/index.ts index 4fe44d168b..2f1204d0ce 100644 --- a/packages/editor-ui/src/plugins/telemetry/index.ts +++ b/packages/editor-ui/src/plugins/telemetry/index.ts @@ -87,7 +87,6 @@ export class Telemetry { } else { this.rudderStack.reset(); - this.rudderStack.identify(undefined, traits); } }