From 0368ad4516974bfde92c502d028aef72bccf72e6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 30 Oct 2020 20:20:58 +0000 Subject: [PATCH] Fix room directory events happening in the wrong order for Funnels --- src/CountlyAnalytics.ts | 14 +++++++++++--- src/components/structures/RoomDirectory.js | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/CountlyAnalytics.ts b/src/CountlyAnalytics.ts index 36d4b5ae8c..b4727bc88b 100644 --- a/src/CountlyAnalytics.ts +++ b/src/CountlyAnalytics.ts @@ -210,6 +210,10 @@ interface ISendMessageEvent extends IEvent { interface IRoomDirectoryEvent extends IEvent { key: "room_directory"; +} + +interface IRoomDirectoryDoneEvent extends IEvent { + key: "room_directory_done"; dur: number; // time spent in the room directory modal } @@ -666,8 +670,8 @@ export default class CountlyAnalytics { private queue(args: Omit & Partial>) { const {count = 1, ...rest} = args; const ev = { - ...rest, ...this.getTimeParams(), + ...rest, count, platform: this.appPlatform, app_version: this.appVersion, @@ -913,8 +917,12 @@ export default class CountlyAnalytics { }, roomId); } + public trackRoomDirectoryBegin() { + this.track("room_directory"); + } + public trackRoomDirectory(startTime: number) { - this.track("room_directory", {}, null, { + this.track("room_directory_done", {}, null, { dur: CountlyAnalytics.getTimestamp() - startTime, }); } @@ -932,7 +940,7 @@ export default class CountlyAnalytics { key: E["key"], segments?: Omit, roomId?: string, - args?: Partial>, + args?: Partial>, anonymous = false, ) { if (this.disabled && !anonymous) return; diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index e5c828b442..ece70e3a8f 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -50,6 +50,7 @@ export default class RoomDirectory extends React.Component { constructor(props) { super(props); + CountlyAnalytics.instance.trackRoomDirectoryBegin(); this.startTime = CountlyAnalytics.getTimestamp(); const selectedCommunityId = GroupFilterOrderStore.getSelectedTags()[0];