diff --git a/packages/hms-video-store/src/analytics/AnalyticsEventFactory.ts b/packages/hms-video-store/src/analytics/AnalyticsEventFactory.ts index 79099f6a7f..8a70bf8259 100644 --- a/packages/hms-video-store/src/analytics/AnalyticsEventFactory.ts +++ b/packages/hms-video-store/src/analytics/AnalyticsEventFactory.ts @@ -245,6 +245,14 @@ export default class AnalyticsEventFactory { }); } + static transportLeave() { + return new AnalyticsEvent({ + name: 'transport.leave', + level: AnalyticsEventLevel.INFO, + properties: {}, + }); + } + private static eventNameFor(name: string, ok: boolean) { const suffix = ok ? 'success' : 'failed'; return `${name}.${suffix}`; diff --git a/packages/hms-video-store/src/common/PluginUsageTracker.ts b/packages/hms-video-store/src/common/PluginUsageTracker.ts index 9621d6ba17..248550ff41 100644 --- a/packages/hms-video-store/src/common/PluginUsageTracker.ts +++ b/packages/hms-video-store/src/common/PluginUsageTracker.ts @@ -21,7 +21,7 @@ class PluginUsageTracker { updatePluginUsageData = (event: AnalyticsEvent, sessionID: string) => { // Sent on leave, after krisp usage is sent - if (event.name === 'subscriber.stats') { + if (event.name === 'transport.leave') { this.cleanup(sessionID); return; } diff --git a/packages/hms-video-store/src/transport/index.ts b/packages/hms-video-store/src/transport/index.ts index 14bdbbe447..a4f45f8a5d 100644 --- a/packages/hms-video-store/src/transport/index.ts +++ b/packages/hms-video-store/src/transport/index.ts @@ -497,6 +497,7 @@ export default class HMSTransport { try { const sessionID = this.store.getRoom()?.sessionId || ''; this.eventBus.analytics.publish(AnalyticsEventFactory.getKrispUsage(sessionID)); + this.eventBus.analytics.publish(AnalyticsEventFactory.transportLeave()); this.state = TransportState.Leaving; this.publishStatsAnalytics?.stop(); this.subscribeStatsAnalytics?.stop();