Skip to content

Commit 6a33fd6

Browse files
w
1 parent 163e558 commit 6a33fd6

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/web/src/features/chat/useCreateNewChatThread.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ import { isServiceError } from "@/lib/utils";
1212
import { createPathWithQueryParams } from "@/lib/utils";
1313
import { SearchScope, SET_CHAT_STATE_SESSION_STORAGE_KEY, SetChatStatePayload } from "./types";
1414
import { useSessionStorage } from "usehooks-ts";
15+
import useCaptureEvent from "@/hooks/useCaptureEvent";
1516

1617
export const useCreateNewChatThread = () => {
1718
const domain = useDomain();
1819
const [isLoading, setIsLoading] = useState(false);
1920
const { toast } = useToast();
2021
const router = useRouter();
22+
const captureEvent = useCaptureEvent();
2123

2224
const [, setChatState] = useSessionStorage<SetChatStatePayload | null>(SET_CHAT_STATE_SESSION_STORAGE_KEY, null);
2325

@@ -38,6 +40,8 @@ export const useCreateNewChatThread = () => {
3840
return;
3941
}
4042

43+
captureEvent('wa_chat_thread_created', {});
44+
4145
setChatState({
4246
inputMessage,
4347
selectedSearchScopes,
@@ -47,7 +51,7 @@ export const useCreateNewChatThread = () => {
4751

4852
router.push(url);
4953
router.refresh();
50-
}, [domain, router, toast, setChatState]);
54+
}, [domain, router, toast, setChatState, captureEvent]);
5155

5256
return {
5357
createNewChatThread,

packages/web/src/lib/posthogEvents.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ export type PosthogEventMap = {
282282
chatId: string,
283283
messageId: string,
284284
},
285+
wa_chat_thread_created: {},
285286
//////////////////////////////////////////////////////////////////
286287
wa_demo_docs_link_pressed: {},
287288
wa_demo_search_context_card_pressed: {

0 commit comments

Comments
 (0)