From 2c9bce457ff93ec8a4bf62898ec1530867fe0ab6 Mon Sep 17 00:00:00 2001 From: Ore Ogundipe Date: Mon, 26 Aug 2024 17:33:55 -0700 Subject: [PATCH] add: anon metrics for when this is used --- .../modals/activitywatch-modal.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/frontend/src/components/features/integrations/modals/activitywatch-modal.tsx b/frontend/src/components/features/integrations/modals/activitywatch-modal.tsx index 8c832b13..8788c6d3 100644 --- a/frontend/src/components/features/integrations/modals/activitywatch-modal.tsx +++ b/frontend/src/components/features/integrations/modals/activitywatch-modal.tsx @@ -10,6 +10,7 @@ import { Button, Input } from "~/components/ui"; import { activityWatchSteps } from "../data"; import dayjs from "dayjs"; import { writeDataToStore } from "~/services/storage.service"; +import { appInsights } from "~/utils/appInsights"; interface IActivityWatchModalProps { isOpen: boolean; @@ -17,6 +18,7 @@ interface IActivityWatchModalProps { } export const ActivityWatchModal: FC = ({ isOpen, onCloseModal }) => { + const user = useSession(); const [hostList, setHostList] = useState<{ [bucketId: string]: IBucket }>({}); const [selectedHost, setSelectedHost] = useState(""); @@ -48,6 +50,14 @@ export const ActivityWatchModal: FC = ({ isOpen, onClo useEffect(() => { if (selectedHost) { localStorage.setItem("selectedActivityWatchHost", selectedHost); + + appInsights.trackEvent({ + name: "ActivityWatchHostSelected", + properties: { + userNpub: user?.data?.user?.email, // this is actually the npub, need to cast the session type so I can use the right selection + unixTimestamp: dayjs().unix(), + }, + }); } }, [selectedHost]); @@ -185,6 +195,14 @@ export const ActivityWatchModal: FC = ({ isOpen, onClo console.log("Length of data", data.length); writeDataToStore("activitywatch", data, endDate.unix().toString(), "download"); + + appInsights.trackEvent({ + name: "ActivityWatchDataDownloaded", + properties: { + userNpub: user?.data?.user?.email, // this is actually the npub, need to cast the session type so I can use the right selection + unixTimestamp: dayjs().unix(), + }, + }); }} leftIcon={} disabled={!selectedHost}