mirror of https://github.com/vector-im/riot-web
Manually track page views
parent
93962c0aca
commit
f358deb6c4
|
@ -28,6 +28,13 @@ export interface IRoomEvent extends IPseudonymousEvent {
|
|||
hashedRoomId: string
|
||||
}
|
||||
|
||||
interface IPageView extends IAnonymousEvent {
|
||||
eventName: "$pageview",
|
||||
properties: {
|
||||
durationMs?: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface IWelcomeScreenLoad extends IAnonymousEvent {
|
||||
key: "welcome_screen_load",
|
||||
}
|
||||
|
@ -205,6 +212,12 @@ export class PosthogAnalytics {
|
|||
};
|
||||
await this.trackPseudonymousEvent(eventName, updatedProperties);
|
||||
}
|
||||
|
||||
public async trackPageView(durationMs: number) {
|
||||
await this.trackAnonymousEvent<IPageView>("$pageview", {
|
||||
durationMs,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function getAnalytics(): PosthogAnalytics {
|
||||
|
|
|
@ -107,7 +107,7 @@ import UIStore, { UI_EVENTS } from "../../stores/UIStore";
|
|||
import SoftLogout from './auth/SoftLogout';
|
||||
import { makeRoomPermalink } from "../../utils/permalinks/Permalinks";
|
||||
import { copyPlaintext } from "../../utils/strings";
|
||||
import { Anonymity, getAnalytics } from '../../PosthogAnalytics';
|
||||
import { Anonymity, getAnalytics, IPageChange } from '../../PosthogAnalytics';
|
||||
|
||||
/** constants for MatrixChat.state.view */
|
||||
export enum Views {
|
||||
|
@ -445,6 +445,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
const durationMs = this.stopPageChangeTimer();
|
||||
Analytics.trackPageChange(durationMs);
|
||||
CountlyAnalytics.instance.trackPageChange(durationMs);
|
||||
getAnalytics().trackPageView(durationMs);
|
||||
}
|
||||
if (this.focusComposer) {
|
||||
dis.fire(Action.FocusSendMessageComposer);
|
||||
|
|
Loading…
Reference in New Issue