From c52e8b53aa46f688de669d91653bacaa221bf900 Mon Sep 17 00:00:00 2001 From: Sean Oliver <882952+seanoliver@users.noreply.github.com> Date: Wed, 29 Oct 2025 12:38:45 -0700 Subject: [PATCH] Fix table_quickstart_opened event to track control group (#39986) * Fix table_quickstart_opened event to track control group Previously, the control group was excluded from exposure tracking because activeQuickstartVariant filtered out CONTROL variants. This prevented establishing a baseline for A/B test analysis. Changes: - Add shouldTrackExposure variable to separate tracking from rendering logic - Track all variants including control when conditions are met - Add explicit type narrowing for TypeScript safety - Update comment to document control as valid variant The event now fires for all users in the experiment (including control) when viewing NewTab on projects < 7 days old in table editor mode. * Update apps/studio/components/layouts/Tabs/NewTab.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- apps/studio/components/layouts/Tabs/NewTab.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/studio/components/layouts/Tabs/NewTab.tsx b/apps/studio/components/layouts/Tabs/NewTab.tsx index 5be5c5bee94..db50b04f657 100644 --- a/apps/studio/components/layouts/Tabs/NewTab.tsx +++ b/apps/studio/components/layouts/Tabs/NewTab.tsx @@ -81,7 +81,7 @@ export function NewTab() { /** * Returns: - * - `QuickstartVariant`: user variation (`ai`, `templates`, `assistant`) + * - `QuickstartVariant`: user variation (`control`, `ai`, `templates`, `assistant`) * - `false`: user not yet bucketed or not targeted for experiment * - `undefined`: PostHog still loading */ @@ -102,14 +102,20 @@ export function NewTab() { ? tableQuickstartVariant : null + const shouldTrackExposure = + editor !== 'sql' && + isNewProject && + tableQuickstartVariant !== false && + tableQuickstartVariant !== undefined + useEffect(() => { - if (activeQuickstartVariant && !hasTrackedExposure.current) { + if (shouldTrackExposure && !hasTrackedExposure.current) { hasTrackedExposure.current = true track('table_quickstart_opened', { - variant: activeQuickstartVariant, + variant: tableQuickstartVariant, }) } - }, [activeQuickstartVariant, track]) + }, [shouldTrackExposure, tableQuickstartVariant, track]) const handleOpenAssistant = () => { if (isCreatingChat) return