mirror of
https://github.com/StanGirard/quivr.git
synced 2024-09-11 13:15:41 +03:00
feat: add headless question tracking (#1051)
This commit is contained in:
parent
072d97adb1
commit
6e43e6f16f
@ -24,7 +24,7 @@ export const useChat = () => {
|
||||
const [generatingAnswer, setGeneratingAnswer] = useState(false);
|
||||
|
||||
const { history } = useChatContext();
|
||||
const { currentBrain, currentPromptId } = useBrainContext();
|
||||
const { currentBrain, currentPromptId, currentBrainId } = useBrainContext();
|
||||
const { publish } = useToast();
|
||||
const { createChat } = useChatApi();
|
||||
|
||||
@ -55,7 +55,11 @@ export const useChat = () => {
|
||||
//TODO: update chat list here
|
||||
}
|
||||
|
||||
void track("QUESTION_ASKED");
|
||||
void track("QUESTION_ASKED", {
|
||||
brainId: currentBrainId,
|
||||
promptId: currentPromptId,
|
||||
});
|
||||
|
||||
const chatConfig = getChatConfigFromLocalStorage(currentChatId);
|
||||
|
||||
const chatQuestion: ChatQuestion = {
|
||||
|
@ -9,7 +9,10 @@ export const useEventTracking = () => {
|
||||
const analytics = useJune();
|
||||
const { session } = useSupabase();
|
||||
|
||||
const track = async (event: string): Promise<void> => {
|
||||
const track = async (
|
||||
event: string,
|
||||
properties?: Record<string, unknown>
|
||||
): Promise<void> => {
|
||||
console.log("Event to track", event);
|
||||
if (analytics === undefined) {
|
||||
console.log("No analytics found");
|
||||
@ -17,7 +20,7 @@ export const useEventTracking = () => {
|
||||
return;
|
||||
}
|
||||
await analytics.identify(session?.user.id, { email: session?.user.email });
|
||||
await analytics.track(event);
|
||||
await analytics.track(event, properties);
|
||||
};
|
||||
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user