diff --git a/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ChatBar/components/MentionInput/hooks/useMentionInput.tsx b/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ChatBar/components/MentionInput/hooks/useMentionInput.tsx index 9a6a42bdd..74da1cc36 100644 --- a/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ChatBar/components/MentionInput/hooks/useMentionInput.tsx +++ b/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ChatBar/components/MentionInput/hooks/useMentionInput.tsx @@ -13,9 +13,9 @@ import { MentionTriggerType, } from "@/app/chat/[chatId]/components/ActionsBar/types"; import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext"; - import "@draft-js-plugins/mention/lib/plugin.css"; import "draft-js/dist/Draft.css"; +import { useJune } from "@/services/analytics/useJune"; import { useMentionPlugin } from "./helpers/MentionPlugin"; import { useMentionState } from "./helpers/MentionState"; @@ -41,6 +41,7 @@ export const useMentionInput = ({ setCurrentPromptId, } = useBrainContext(); + const analytics = useJune(); const { editorState, setEditorState, @@ -65,10 +66,12 @@ export const useMentionInput = ({ const onAddMention = (mention: MentionData) => { if (mention.trigger === "#") { + void analytics?.track("CHANGE_PROMPT"); setCurrentPromptId(mention.id as UUID); } if (mention.trigger === "@") { + void analytics?.track("CHANGE_BRAIN"); setCurrentBrainId(mention.id as UUID); } diff --git a/frontend/lib/context/BrainProvider/hooks/useBrainProvider.ts b/frontend/lib/context/BrainProvider/hooks/useBrainProvider.ts index 4a927ee22..b9b35e597 100644 --- a/frontend/lib/context/BrainProvider/hooks/useBrainProvider.ts +++ b/frontend/lib/context/BrainProvider/hooks/useBrainProvider.ts @@ -81,9 +81,8 @@ export const useBrainProvider = () => { const newActiveBrain = { id, name }; saveBrainInLocalStorage(newActiveBrain); setCurrentBrainId(id); - void track("CHANGE_BRAIN"); }, - [track] + [] ); const setDefaultBrain = useCallback(async () => {