time to convert to user

pull/208/head
Tim Pechersky 2021-08-31 13:36:21 +02:00
rodzic 5896c04051
commit e2a0822f79
1 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -8,7 +8,7 @@ import UIContext from "../UIProvider/context";
const AnalyticsProvider = ({ children }) => {
const clientID = useClientID();
const analytics = process.env.NEXT_PUBLIC_MIXPANEL_TOKEN;
const { user } = useUser();
const { user, isInit } = useUser();
const [isMixpanelReady, setIsLoaded] = useState(false);
const router = useRouter();
@ -19,6 +19,12 @@ const AnalyticsProvider = ({ children }) => {
}
}, [ui.isOnboardingComplete, isMixpanelReady, user]);
useEffect(() => {
if (!user && isInit && isMixpanelReady) {
mixpanel.time_event(MIXPANEL_EVENTS.CONVERT_TO_USER);
}
}, [user, isInit, isMixpanelReady]);
useEffect(() => {
if (ui.onboardingStep && isMixpanelReady) {
mixpanel.people.set(MIXPANEL_EVENTS.ONBOARDING_STEPS, ui.onboardingStep);