From f2044b5838b867272417130c618e36809aa72b9d Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 19 Jul 2023 16:11:56 -0700 Subject: [PATCH] web: fix newsletter signup --- web/app/api/signup/route.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/web/app/api/signup/route.ts b/web/app/api/signup/route.ts index b08636d5..d391ec31 100644 --- a/web/app/api/signup/route.ts +++ b/web/app/api/signup/route.ts @@ -6,12 +6,22 @@ const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY || ' export async function POST(req: Request) { const { email } = await req.json() - analytics.identify({ - anonymousId: uuid(), + const id = uuid() + + await analytics.identify({ + anonymousId: id, traits: { email, }, }) + await analytics.track({ + anonymousId: id, + event: 'signup', + properties: { + email, + }, + }) + return new Response(null, { status: 200 }) }