diff --git a/package.json b/package.json index f0acbba77df..5c81f97764f 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ }, "dependencies": { "@babel/runtime": "^7.12.5", - "@matrix-org/analytics-events": "^0.9.0", + "@matrix-org/analytics-events": "^0.10.0", "@matrix-org/emojibase-bindings": "^1.1.2", "@matrix-org/matrix-wysiwyg": "2.17.0", "@matrix-org/olm": "3.2.15", diff --git a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx index 1b4874562b5..8436b3e1b4b 100644 --- a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx +++ b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx @@ -31,6 +31,7 @@ import { RightPanelPhases } from "../../../../stores/right-panel/RightPanelStore import { useUnreadThreadRooms } from "./useUnreadThreadRooms"; import { StatelessNotificationBadge } from "../../rooms/NotificationBadge/StatelessNotificationBadge"; import { NotificationLevel } from "../../../../stores/notifications/NotificationLevel"; +import PosthogTrackers from "../../../../PosthogTrackers"; interface ThreadsActivityCentreProps { /** @@ -51,7 +52,12 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen { + // Track only when the Threads Activity Centre is opened + if (newOpen) PosthogTrackers.trackInteraction("WebThreadsActivityCentreButton"); + + setOpen(newOpen); + }} side="right" title={_t("threads_activity_centre|header")} trigger={} @@ -100,13 +106,15 @@ function ThreadsActivityRow({ room, onClick, notificationLevel }: ThreadsActivit // so it will open once the room appears. RightPanelStore.instance.setCard({ phase: RightPanelPhases.ThreadPanel }, true, room.roomId); + // Track the click on the room + PosthogTrackers.trackInteraction("WebThreadsActivityCentreRoomItem", event); + // Display the selected room in the timeline defaultDispatcher.dispatch({ action: Action.ViewRoom, show_room_tile: true, // make sure the room is visible in the list room_id: room.roomId, - metricsTrigger: "RoomList", - metricsViaKeyboard: event.type !== "click", + metricsTrigger: "WebThreadsActivityCentre", }); }} label={room.name} diff --git a/yarn.lock b/yarn.lock index affb509dfaf..8315cf37c48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1819,10 +1819,10 @@ resolved "https://registry.yarnpkg.com/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz#497c67a1cef50d1a2459ba60f315e448d2ad87fe" integrity sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q== -"@matrix-org/analytics-events@^0.9.0": - version "0.9.0" - resolved "https://registry.yarnpkg.com/@matrix-org/analytics-events/-/analytics-events-0.9.0.tgz#ac958b1f49ab84af6325da0264df2f459e87a985" - integrity sha512-pKhIspX2lHNe3sUdi42T8lL3RPFqI0kHkxfrF9R0jneJska6GNBzQwPENMY1SjM3YnGYdhz5GZ/QMm6gozuiJg== +"@matrix-org/analytics-events@^0.10.0": + version "0.10.0" + resolved "https://registry.yarnpkg.com/@matrix-org/analytics-events/-/analytics-events-0.10.0.tgz#d4d8b7859a516e888050d616ebbb0da539a15b1e" + integrity sha512-qzi7szEWxcl3nW2LDfq+SvFH/of/B/lwhfFUelhihGfr5TBPwgqM95Euc9GeYMZkU8Xm/2f5hYfA0ZleD6RKaA== "@matrix-org/emojibase-bindings@^1.1.2": version "1.1.3"