Skip to content

Commit c6a45ce

Browse files
committed
📈(frontend) track user interactions from left side panel
Add analytics tracking for actions initiated from the sidebar to monitor feature usage patterns and user engagement metrics.
1 parent 3cfcdcf commit c6a45ce

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/frontend/apps/impress/src/features/left-panel/components/LeftPanelHeader.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { useCreateDoc } from '@/docs/doc-management';
88
import { DocSearchModal } from '@/docs/doc-search';
99
import { useAuth } from '@/features/auth';
1010
import { useCmdK } from '@/hook/useCmdK';
11+
import { useAnalytics } from '@/libs';
1112

1213
import { useLeftPanelStore } from '../stores';
1314

1415
export const LeftPanelHeader = ({ children }: PropsWithChildren) => {
1516
const router = useRouter();
1617
const { authenticated } = useAuth();
18+
const { trackEvent } = useAnalytics();
1719
const [isSearchModalOpen, setIsSearchModalOpen] = useState(false);
1820

1921
const openSearchModal = useCallback(() => {
@@ -23,8 +25,10 @@ export const LeftPanelHeader = ({ children }: PropsWithChildren) => {
2325
return;
2426
}
2527

28+
trackEvent({ eventName: 'openSearchModal', position: 'LeftPanelHeader' });
29+
2630
setIsSearchModalOpen(true);
27-
}, []);
31+
}, [trackEvent]);
2832

2933
const closeSearchModal = useCallback(() => {
3034
setIsSearchModalOpen(false);
@@ -46,6 +50,7 @@ export const LeftPanelHeader = ({ children }: PropsWithChildren) => {
4650
};
4751

4852
const createNewDoc = () => {
53+
trackEvent({ eventName: 'createNewDoc', position: 'LeftPanelHeader' });
4954
createDoc();
5055
};
5156

0 commit comments

Comments
 (0)