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