diff --git a/server/src/routes/auth.ts b/server/src/routes/auth.ts index f4bf742e..8139bc77 100644 --- a/server/src/routes/auth.ts +++ b/server/src/routes/auth.ts @@ -6,6 +6,7 @@ import { hashPassword, comparePassword } from '../utils/auth'; import { requireSignIn } from '../middlewares/auth'; import { genAPIKey } from '../utils/api'; import { google } from 'googleapis'; +import captureServerAnalytics from "../utils/analytics" export const router = Router(); interface AuthenticatedRequest extends Request { @@ -31,6 +32,15 @@ router.post('/register', async (req, res) => { res.cookie('token', token, { httpOnly: true }) + captureServerAnalytics.capture({ + distinctId: user.id, + event: 'maxun-oss-user-registered', + properties: { + email: user.email, + userId: user.id, + registeredAt: new Date().toISOString() + } + }) res.json(user) } catch (error: any) { res.status(500).send(`Could not register user - ${error.message}`)