diff --git a/src/client/features/gsc/GscReEngagementModal.tsx b/src/client/features/gsc/GscReEngagementModal.tsx index 0d77382..6d3511e 100644 --- a/src/client/features/gsc/GscReEngagementModal.tsx +++ b/src/client/features/gsc/GscReEngagementModal.tsx @@ -48,6 +48,10 @@ export function GscReEngagementModal({ }, }); + // Legacy users — those who finished onboarding before it included the Search + // Console step — have no gscNudgeDismissedAt set, so they're the only ones who + // see this. Anyone who completes current onboarding gets it stamped (they + // already saw that step), and dismissing/connecting clears it too. const eligible = hosted && !suppressed && diff --git a/src/db/app.schema.ts b/src/db/app.schema.ts index c75deb0..5a8b299 100644 --- a/src/db/app.schema.ts +++ b/src/db/app.schema.ts @@ -24,9 +24,9 @@ export const userOnboardingAnswers = sqliteTable( foundVia: text("found_via"), mcpSetupIntent: text("mcp_setup_intent"), completedAt: text("completed_at"), - // Set when the user dismisses (or acts on) the one-time "connect Search - // Console" nudge shown to people who finished onboarding before the GSC - // step existed. Null = never shown/dismissed. + // Set when the user resolves the Search Console ask, either in current + // onboarding or via the one-time re-engagement nudge for legacy users. + // Null = not yet shown/resolved. gscNudgeDismissedAt: text("gsc_nudge_dismissed_at"), createdAt: text("created_at") .notNull() diff --git a/src/serverFunctions/onboarding.ts b/src/serverFunctions/onboarding.ts index f39fa62..f1eab11 100644 --- a/src/serverFunctions/onboarding.ts +++ b/src/serverFunctions/onboarding.ts @@ -82,7 +82,12 @@ export const saveOnboardingAnswers = createServerFn({ method: "POST" }) ...(data.mcpSetupIntent !== undefined ? { mcpSetupIntent: data.mcpSetupIntent } : {}), - ...(completedAt !== undefined ? { completedAt } : {}), + // Completing onboarding means the user passed the Search Console step, so + // resolve the GSC prompt — the legacy re-engagement nudge must not fire + // for anyone who already saw that step. + ...(completedAt !== undefined + ? { completedAt, gscNudgeDismissedAt: completedAt } + : {}), updatedAt: now, }; @@ -97,6 +102,7 @@ export const saveOnboardingAnswers = createServerFn({ method: "POST" }) foundVia: data.foundVia, mcpSetupIntent: data.mcpSetupIntent, completedAt, + gscNudgeDismissedAt: completedAt, updatedAt: now, }) .onConflictDoUpdate({