Add analytics event for pinned messages

This commit is contained in:
Florian Duros 2024-09-05 16:11:55 +02:00
parent bce710e34e
commit 08d1b6ceae
No known key found for this signature in database
GPG key ID: A5BBB4041B493F15
8 changed files with 48 additions and 8 deletions

View file

@ -42,6 +42,7 @@ import { OpenForwardDialogPayload } from "../../../dispatcher/payloads/OpenForwa
import { createRedactEventDialog } from "../dialogs/ConfirmRedactDialog";
import { ShowThreadPayload } from "../../../dispatcher/payloads/ShowThreadPayload";
import PinningUtils from "../../../utils/PinningUtils.ts";
import PosthogTrackers from "../../../PosthogTrackers.ts";
const AVATAR_SIZE = "32px";
@ -152,6 +153,8 @@ function PinMenu({ event, room, permalinkCreator }: PinMenuProps): JSX.Element {
* View the event in the timeline.
*/
const onViewInTimeline = useCallback(() => {
PosthogTrackers.trackInteraction("PinnedMessageListViewTimeline");
dis.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
event_id: event.getId(),
@ -173,6 +176,7 @@ function PinMenu({ event, room, permalinkCreator }: PinMenuProps): JSX.Element {
*/
const onUnpin = useCallback(async (): Promise<void> => {
await PinningUtils.pinOrUnpinEvent(matrixClient, event);
PosthogTrackers.trackPinUnpinMessage("Unpin", "MessagePinningList");
}, [event, matrixClient]);
const contentActionable = isContentActionable(event);