web: fix newsletter signup

This commit is contained in:
Jeffrey Morgan 2023-07-19 16:11:56 -07:00
parent d53988f619
commit f2044b5838

View file

@ -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 })
}