From 4ee5d8f15bc3f77e4532a1ce626073c264c3d634 Mon Sep 17 00:00:00 2001 From: Danny Neira <16809145+dannyneira@users.noreply.github.com> Date: Fri, 14 Aug 2026 15:28:48 -0600 Subject: [PATCH 1/2] feat: enable Kapa anonymous user tracking on docs chat Switch KapaProvider from userTrackingMode none to cookie so unique visitors are tracked via the first-party kapa_web_id cookie. When a user submits a support handoff email, attach it to window.kapaSettings so later Kapa turns can enrich the same user profile. Co-Authored-By: Warp --- src/components/KapaChatLauncher.tsx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/KapaChatLauncher.tsx b/src/components/KapaChatLauncher.tsx index e395acf8..660bdf25 100644 --- a/src/components/KapaChatLauncher.tsx +++ b/src/components/KapaChatLauncher.tsx @@ -730,6 +730,24 @@ function ChatSurface({ title, welcomeMessage, autoOpen = false, onNewConversatio setHandoffErrorMessage('Enter a valid email address to continue.'); return; } + // Enrich Kapa analytics when the user self-identifies during handoff. + // Anonymous cookie tracking still covers earlier turns in the thread. + const windowWithKapaSettings = window as Window & { + kapaSettings?: { + user?: { + email?: string; + uniqueClientId?: string; + metadata?: Record; + }; + }; + }; + windowWithKapaSettings.kapaSettings = { + ...(windowWithKapaSettings.kapaSettings ?? {}), + user: { + ...(windowWithKapaSettings.kapaSettings?.user ?? {}), + email: userEmail, + }, + }; const localStorageThreadId = localStorage.getItem('warp_docs_kapa_thread_id'); const activeThreadId = threadId || storedThreadId || localStorageThreadId; if (!activeThreadId) { @@ -1244,7 +1262,10 @@ export default function KapaChatLauncher({ autoOpen = false }: { autoOpen?: bool key={chatSessionKey} integrationId={integrationId} callbacks={callbacks} - userTrackingMode="none" + // Anonymous first-party cookie (`kapa_web_id`). Default in the Kapa + // React SDK; set explicitly so we do not accidentally ship `none` again. + // https://docs.kapa.ai/dev/sdk/components/KapaProvider#user-tracking-mode + userTrackingMode="cookie" > Date: Fri, 14 Aug 2026 15:31:22 -0600 Subject: [PATCH 2/2] feat: enable Kapa cookie user tracking only Drop handoff email enrichment; keep anonymous first-party cookie tracking. Co-Authored-By: Warp --- src/components/KapaChatLauncher.tsx | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/components/KapaChatLauncher.tsx b/src/components/KapaChatLauncher.tsx index 660bdf25..816f333a 100644 --- a/src/components/KapaChatLauncher.tsx +++ b/src/components/KapaChatLauncher.tsx @@ -730,24 +730,6 @@ function ChatSurface({ title, welcomeMessage, autoOpen = false, onNewConversatio setHandoffErrorMessage('Enter a valid email address to continue.'); return; } - // Enrich Kapa analytics when the user self-identifies during handoff. - // Anonymous cookie tracking still covers earlier turns in the thread. - const windowWithKapaSettings = window as Window & { - kapaSettings?: { - user?: { - email?: string; - uniqueClientId?: string; - metadata?: Record; - }; - }; - }; - windowWithKapaSettings.kapaSettings = { - ...(windowWithKapaSettings.kapaSettings ?? {}), - user: { - ...(windowWithKapaSettings.kapaSettings?.user ?? {}), - email: userEmail, - }, - }; const localStorageThreadId = localStorage.getItem('warp_docs_kapa_thread_id'); const activeThreadId = threadId || storedThreadId || localStorageThreadId; if (!activeThreadId) {