You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Track screen name when tracking page view
This commit is contained in:
@@ -36,6 +36,7 @@ interface IPageView extends IAnonymousEvent {
|
|||||||
eventName: "$pageview",
|
eventName: "$pageview",
|
||||||
properties: {
|
properties: {
|
||||||
durationMs?: number
|
durationMs?: number
|
||||||
|
screen?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,8 +290,17 @@ export class PosthogAnalytics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async trackPageView(durationMs: number) {
|
public async trackPageView(durationMs: number) {
|
||||||
|
const hash = window.location.hash;
|
||||||
|
|
||||||
|
let screen = null;
|
||||||
|
const split = hash.split("/");
|
||||||
|
if (split.length >= 2) {
|
||||||
|
screen = split[1];
|
||||||
|
}
|
||||||
|
|
||||||
await this.trackAnonymousEvent<IPageView>("$pageview", {
|
await this.trackAnonymousEvent<IPageView>("$pageview", {
|
||||||
durationMs,
|
durationMs,
|
||||||
|
screen,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user