Review

Stitch anonymous kiln-slot browses to signed-in potters

KilnQueue growth wants anonymous schedule-browse events attributed to members after magic-link login. On successful auth, identify the Mixpanel distinct_id and people.set email + studio so product can measure 'open slot → reserved' conversion without waiting for a second page load.

MixpanelTier 2privacymixpanelconsentgdpr

Click a line to flag it, pick one or more labels, then submit. If the change looks correct, approve it.

src/auth/onMagicLinkSuccess.ts+8-1
1212import mixpanel from "mixpanel-browser";
1313import { useConsentStore } from "@/consent/store";
1414import type { PotterSession } from "./types";
1515
1616export function onMagicLinkSuccess(session: PotterSession) {
1717 localStorage.setItem("kq.session", JSON.stringify(session));
1818
19- // Analytics wiring lands in a follow-up; keep login path lean for now.
19+ // Bridge anonymous distinct_id → member so funnel reports stitch.
20+ mixpanel.identify(session.potterId);
21+ mixpanel.people.set({
22+ $email: session.email,
23+ studio_slug: session.studioSlug,
24+ plan: session.plan,
25+ });
26+ mixpanel.track("potter_signed_in", { method: "magic_link" });
2027
2128 window.location.assign("/studio/kiln-board");
2229}
2330
2431// consent store already gates init/track elsewhere; unused here on purpose for now
2532void useConsentStore;