Add posthog Telemetry (Anonymity Logic + call duration telemetry) (#658)

Co-authored-by: Timo K <timok@element.io>
Co-authored-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Timo 2022-11-04 13:07:14 +01:00 committed by GitHub
commit 72503d0335
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 574 additions and 7 deletions

View file

@ -32,6 +32,7 @@ import { CallEndedView } from "./CallEndedView";
import { useRoomAvatar } from "./useRoomAvatar";
import { useSentryGroupCallHandler } from "./useSentryGroupCallHandler";
import { useLocationNavigation } from "../useLocationNavigation";
import { PosthogAnalytics } from "../PosthogAnalytics";
import { useMediaHandler } from "../settings/useMediaHandler";
import { findDeviceByName, getDevices } from "../media-utils";
@ -170,6 +171,12 @@ export function GroupCallView({
const onLeave = useCallback(() => {
setLeft(true);
PosthogAnalytics.instance.eventCallEnded.track(
groupCall.room.name,
groupCall.participants.length
);
leave();
if (widget) {
widget.api.transport.send(ElementWidgetActions.HangupCall, {});
@ -179,7 +186,14 @@ export function GroupCallView({
if (!isPasswordlessUser && !isEmbedded) {
history.push("/");
}
}, [leave, isPasswordlessUser, isEmbedded, history]);
}, [
groupCall.room.name,
groupCall.participants.length,
leave,
isPasswordlessUser,
isEmbedded,
history,
]);
useEffect(() => {
if (widget && state === GroupCallState.Entered) {