mirror of
https://github.com/suitenumerique/docs
synced 2026-04-21 13:37:20 +00:00
📈(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.
This commit is contained in:
parent
3cfcdcf036
commit
c6a45ce58a
1 changed files with 6 additions and 1 deletions
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue