Skip to content

Commit c52e8b5

Browse files
seanoliverCopilot
andauthored
Fix table_quickstart_opened event to track control group (supabase#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 <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 5ac8759 commit c52e8b5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

apps/studio/components/layouts/Tabs/NewTab.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function NewTab() {
8181

8282
/**
8383
* Returns:
84-
* - `QuickstartVariant`: user variation (`ai`, `templates`, `assistant`)
84+
* - `QuickstartVariant`: user variation (`control`, `ai`, `templates`, `assistant`)
8585
* - `false`: user not yet bucketed or not targeted for experiment
8686
* - `undefined`: PostHog still loading
8787
*/
@@ -102,14 +102,20 @@ export function NewTab() {
102102
? tableQuickstartVariant
103103
: null
104104

105+
const shouldTrackExposure =
106+
editor !== 'sql' &&
107+
isNewProject &&
108+
tableQuickstartVariant !== false &&
109+
tableQuickstartVariant !== undefined
110+
105111
useEffect(() => {
106-
if (activeQuickstartVariant && !hasTrackedExposure.current) {
112+
if (shouldTrackExposure && !hasTrackedExposure.current) {
107113
hasTrackedExposure.current = true
108114
track('table_quickstart_opened', {
109-
variant: activeQuickstartVariant,
115+
variant: tableQuickstartVariant,
110116
})
111117
}
112-
}, [activeQuickstartVariant, track])
118+
}, [shouldTrackExposure, tableQuickstartVariant, track])
113119

114120
const handleOpenAssistant = () => {
115121
if (isCreatingChat) return

0 commit comments

Comments
 (0)