diff --git a/server/src/controllers/auth.controller.ts b/server/src/controllers/auth.controller.ts index ff5afb1f..711f97ae 100644 --- a/server/src/controllers/auth.controller.ts +++ b/server/src/controllers/auth.controller.ts @@ -100,6 +100,11 @@ const logout = async ( } }); } + // mixpanel tracking + mixpanel.track('Logout', { + distinct_id: req.user ? (req.user as IUser)._id : undefined, + email: req.user ? (req.user as IUser).email : undefined, + }); }); }; @@ -169,6 +174,11 @@ const register = async ( await user!.save(); await emailVerificationLink(lowercaseEmail, verificationToken); } + // mixpanel tracking + mixpanel.track('Register', { + distinct_id: user?._id, + email: user?.email, + }); res.sendStatus(StatusCode.CREATED); } catch (err) { next(ApiError.internal('Unable to register user.')); @@ -205,6 +215,11 @@ const verifyAccount = async ( user!.verified = true; try { await user!.save(); + // mixpanel tracking + mixpanel.track('Verify Account', { + distinct_id: user._id, + email: user.email, + }); res.sendStatus(StatusCode.OK); } catch (err) { next(ApiError.internal('Unable to verify the account.'));