matrix-react-sdk
Version:
SDK for matrix.org using React
35 lines (34 loc) • 1.52 kB
TypeScript
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";
export type ScreenName = ScreenEvent["$current_url"];
export type InteractionName = InteractionEvent["name"];
export default class PosthogTrackers {
private static internalInstance;
static get instance(): PosthogTrackers;
private view;
private pageType?;
private override?;
trackPageChange(view: Views, pageType: PageType | undefined, durationMs: number): void;
private trackPage;
trackOverride(screenName: ScreenName): void;
clearOverride(screenName: ScreenName): void;
static trackInteraction(name: InteractionName, ev?: SyntheticEvent | Event, index?: number): void;
/**
* Track a pin or unpin action on a message.
* @param kind - Is pin or unpin.
* @param from - From where the action is triggered.
*/
static trackPinUnpinMessage(kind: PinUnpinAction["kind"], from: PinUnpinAction["from"]): void;
}
export declare class PosthogScreenTracker extends PureComponent<{
screenName: ScreenName;
}> {
componentDidMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
render(): React.ReactNode;
}