Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 06bd2d9

Browse files
authored
Merge pull request #5379 from matrix-org/t3chguy/countly
Fix room directory events happening in the wrong order for Funnels
2 parents 6d2dc63 + 0368ad4 commit 06bd2d9

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/CountlyAnalytics.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ interface ISendMessageEvent extends IEvent {
210210

211211
interface IRoomDirectoryEvent extends IEvent {
212212
key: "room_directory";
213+
}
214+
215+
interface IRoomDirectoryDoneEvent extends IEvent {
216+
key: "room_directory_done";
213217
dur: number; // time spent in the room directory modal
214218
}
215219

@@ -666,8 +670,8 @@ export default class CountlyAnalytics {
666670
private queue(args: Omit<IEvent, "timestamp" | "hour" | "dow" | "count"> & Partial<Pick<IEvent, "count">>) {
667671
const {count = 1, ...rest} = args;
668672
const ev = {
669-
...rest,
670673
...this.getTimeParams(),
674+
...rest,
671675
count,
672676
platform: this.appPlatform,
673677
app_version: this.appVersion,
@@ -913,8 +917,12 @@ export default class CountlyAnalytics {
913917
}, roomId);
914918
}
915919

920+
public trackRoomDirectoryBegin() {
921+
this.track<IRoomDirectoryEvent>("room_directory");
922+
}
923+
916924
public trackRoomDirectory(startTime: number) {
917-
this.track<IRoomDirectoryEvent>("room_directory", {}, null, {
925+
this.track<IRoomDirectoryDoneEvent>("room_directory_done", {}, null, {
918926
dur: CountlyAnalytics.getTimestamp() - startTime,
919927
});
920928
}
@@ -932,7 +940,7 @@ export default class CountlyAnalytics {
932940
key: E["key"],
933941
segments?: Omit<E["segmentation"], "room_id" | "num_users" | "is_encrypted" | "is_public">,
934942
roomId?: string,
935-
args?: Partial<Pick<E, "dur" | "sum">>,
943+
args?: Partial<Pick<E, "dur" | "sum" | "timestamp">>,
936944
anonymous = false,
937945
) {
938946
if (this.disabled && !anonymous) return;

src/components/structures/RoomDirectory.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default class RoomDirectory extends React.Component {
5050
constructor(props) {
5151
super(props);
5252

53+
CountlyAnalytics.instance.trackRoomDirectoryBegin();
5354
this.startTime = CountlyAnalytics.getTimestamp();
5455

5556
const selectedCommunityId = GroupFilterOrderStore.getSelectedTags()[0];

0 commit comments

Comments
 (0)