Track call disconnections
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
MuteMicrophoneTracker,
|
||||
UndecryptableToDeviceEventTracker,
|
||||
QualitySurveyEventTracker,
|
||||
CallDisconnectedEventTracker,
|
||||
} from "./PosthogEvents";
|
||||
import { Config } from "../config/Config";
|
||||
import { getUrlParams } from "../UrlParams";
|
||||
@@ -437,4 +438,5 @@ export class PosthogAnalytics {
|
||||
public eventMuteCamera = new MuteCameraTracker();
|
||||
public eventUndecryptableToDevice = new UndecryptableToDeviceEventTracker();
|
||||
public eventQualitySurvey = new QualitySurveyEventTracker();
|
||||
public eventCallDisconnected = new CallDisconnectedEventTracker();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { DisconnectReason } from "livekit-client";
|
||||
|
||||
import {
|
||||
IPosthogEvent,
|
||||
PosthogAnalytics,
|
||||
@@ -181,3 +183,17 @@ export class QualitySurveyEventTracker {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
interface CallDisconnectedEvent {
|
||||
eventName: "CallDisconnected";
|
||||
reason?: DisconnectReason;
|
||||
}
|
||||
|
||||
export class CallDisconnectedEventTracker {
|
||||
track(reason?: DisconnectReason) {
|
||||
PosthogAnalytics.instance.trackEvent<CallDisconnectedEvent>({
|
||||
eventName: "CallDisconnected",
|
||||
reason,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,6 +191,7 @@ export function InCallView({
|
||||
|
||||
const onDisconnected = useCallback(
|
||||
(reason?: DisconnectReason) => {
|
||||
PosthogAnalytics.instance.eventCallDisconnected.track(reason);
|
||||
logger.info("Disconnected from livekit call with reason ", reason);
|
||||
onLeave(
|
||||
new Error("Disconnected from LiveKit call with reason " + reason)
|
||||
|
||||
Reference in New Issue
Block a user