Skip to content

Commit

Permalink
logout, register, and verify tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
etweisberg committed Sep 10, 2024
1 parent 58900c4 commit 612a105
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions server/src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
};

Expand Down Expand Up @@ -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.'));
Expand Down Expand Up @@ -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.'));
Expand Down

0 comments on commit 612a105

Please sign in to comment.