From 5441337d7cceff440e3f5f14c1dbea7bff00570e Mon Sep 17 00:00:00 2001 From: zaidmukaddam Date: Thu, 29 Aug 2024 12:27:38 +0530 Subject: [PATCH] feat: Add tracking for search query input --- app/search/page.tsx | 2 ++ pnpm-lock.yaml | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/search/page.tsx b/app/search/page.tsx index 49654f7..208d3de 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -15,6 +15,7 @@ import ReactMarkdown, { Components } from 'react-markdown'; import remarkGfm from 'remark-gfm'; import remarkMath from 'remark-math'; import rehypeKatex from 'rehype-katex'; +import { track } from '@vercel/analytics'; import 'katex/dist/katex.min.css'; import { useChat } from 'ai/react'; import { ToolInvocation } from 'ai'; @@ -1458,6 +1459,7 @@ export default function Home() { const handleFormSubmit = useCallback((e: React.FormEvent) => { e.preventDefault(); if (input.trim()) { + track("search enter", { query: input.trim() }); setHasSubmitted(true); setSuggestedQuestions([]); handleSubmit(e); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9391c62..0040583 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,7 +73,7 @@ dependencies: version: 1.4.0 ai: specifier: latest - version: 3.3.19(openai@4.56.0)(react@18.3.1)(svelte@4.2.18)(vue@3.4.35)(zod@3.23.8) + version: 3.3.20(openai@4.56.0)(react@18.3.1)(svelte@4.2.18)(vue@3.4.35)(zod@3.23.8) class-variance-authority: specifier: ^0.7.0 version: 0.7.0 @@ -1817,8 +1817,8 @@ packages: humanize-ms: 1.2.1 dev: false - /ai@3.3.19(openai@4.56.0)(react@18.3.1)(svelte@4.2.18)(vue@3.4.35)(zod@3.23.8): - resolution: {integrity: sha512-Q3K3cubOYqLVK/5P6oWu5kjjPgAo4Lr+zzLZCCG0HX9b8QemgQCPmZGRNgLNf3a2y6m4NwpjJjAPYHPlb3ytwQ==} + /ai@3.3.20(openai@4.56.0)(react@18.3.1)(svelte@4.2.18)(vue@3.4.35)(zod@3.23.8): + resolution: {integrity: sha512-GKiL34BPVGgSEDkUlt8nyVRZkx1btnbXyw/bZKj1Jx5sCn/OY/qgiACzakhRzC/90UlxmrMsU1rZGW+Xr8+kFA==} engines: {node: '>=18'} peerDependencies: openai: ^4.42.0