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
8 changed files with 48 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
import { PureComponent, SyntheticEvent } from "react";
import { WebScreen as ScreenEvent } from "@matrix-org/analytics-events/types/typescript/WebScreen";
import { Interaction as InteractionEvent } from "@matrix-org/analytics-events/types/typescript/Interaction";
import { PinUnpinAction } from "@matrix-org/analytics-events/types/typescript/PinUnpinAction";
import PageType from "./PageTypes";
import Views from "./Views";
@@ -106,6 +107,19 @@ export default class PosthogTrackers {
name,
});
}
/**
* Track a pin or unpin action on a message.
* @param kind - Is pin or unpin.
* @param from - From where the action is triggered.
*/
public static trackPinUnpinMessage(kind: PinUnpinAction["kind"], from: PinUnpinAction["from"]): void {
PosthogAnalytics.instance.trackEvent<PinUnpinAction>({
eventName: "PinUnpinAction",
kind,
from,
});
}
}
export class PosthogScreenTracker extends PureComponent<{ screenName: ScreenName }> {