From c6a45ce58a465555da859de11044bb3fba64693c Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Sun, 25 May 2025 01:04:59 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=88(frontend)=20track=20user=20interac?= =?UTF-8?q?tions=20from=20left=20side=20panel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add analytics tracking for actions initiated from the sidebar to monitor feature usage patterns and user engagement metrics. --- .../src/features/left-panel/components/LeftPanelHeader.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/frontend/apps/impress/src/features/left-panel/components/LeftPanelHeader.tsx b/src/frontend/apps/impress/src/features/left-panel/components/LeftPanelHeader.tsx index 7177bc2c..72dc3390 100644 --- a/src/frontend/apps/impress/src/features/left-panel/components/LeftPanelHeader.tsx +++ b/src/frontend/apps/impress/src/features/left-panel/components/LeftPanelHeader.tsx @@ -8,12 +8,14 @@ import { useCreateDoc } from '@/docs/doc-management'; import { DocSearchModal } from '@/docs/doc-search'; import { useAuth } from '@/features/auth'; import { useCmdK } from '@/hook/useCmdK'; +import { useAnalytics } from '@/libs'; import { useLeftPanelStore } from '../stores'; export const LeftPanelHeader = ({ children }: PropsWithChildren) => { const router = useRouter(); const { authenticated } = useAuth(); + const { trackEvent } = useAnalytics(); const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); const openSearchModal = useCallback(() => { @@ -23,8 +25,10 @@ export const LeftPanelHeader = ({ children }: PropsWithChildren) => { return; } + trackEvent({ eventName: 'openSearchModal', position: 'LeftPanelHeader' }); + setIsSearchModalOpen(true); - }, []); + }, [trackEvent]); const closeSearchModal = useCallback(() => { setIsSearchModalOpen(false); @@ -46,6 +50,7 @@ export const LeftPanelHeader = ({ children }: PropsWithChildren) => { }; const createNewDoc = () => { + trackEvent({ eventName: 'createNewDoc', position: 'LeftPanelHeader' }); createDoc(); };