Track call disconnections
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
|||||||
MuteMicrophoneTracker,
|
MuteMicrophoneTracker,
|
||||||
UndecryptableToDeviceEventTracker,
|
UndecryptableToDeviceEventTracker,
|
||||||
QualitySurveyEventTracker,
|
QualitySurveyEventTracker,
|
||||||
|
CallDisconnectedEventTracker,
|
||||||
} from "./PosthogEvents";
|
} from "./PosthogEvents";
|
||||||
import { Config } from "../config/Config";
|
import { Config } from "../config/Config";
|
||||||
import { getUrlParams } from "../UrlParams";
|
import { getUrlParams } from "../UrlParams";
|
||||||
@@ -437,4 +438,5 @@ export class PosthogAnalytics {
|
|||||||
public eventMuteCamera = new MuteCameraTracker();
|
public eventMuteCamera = new MuteCameraTracker();
|
||||||
public eventUndecryptableToDevice = new UndecryptableToDeviceEventTracker();
|
public eventUndecryptableToDevice = new UndecryptableToDeviceEventTracker();
|
||||||
public eventQualitySurvey = new QualitySurveyEventTracker();
|
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.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { DisconnectReason } from "livekit-client";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IPosthogEvent,
|
IPosthogEvent,
|
||||||
PosthogAnalytics,
|
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(
|
const onDisconnected = useCallback(
|
||||||
(reason?: DisconnectReason) => {
|
(reason?: DisconnectReason) => {
|
||||||
|
PosthogAnalytics.instance.eventCallDisconnected.track(reason);
|
||||||
logger.info("Disconnected from livekit call with reason ", reason);
|
logger.info("Disconnected from livekit call with reason ", reason);
|
||||||
onLeave(
|
onLeave(
|
||||||
new Error("Disconnected from LiveKit call with reason " + reason)
|
new Error("Disconnected from LiveKit call with reason " + reason)
|
||||||
|
|||||||
Reference in New Issue
Block a user