web: fix newsletter signup
This commit is contained in:
parent
d53988f619
commit
f2044b5838
1 changed files with 12 additions and 2 deletions
|
@ -6,12 +6,22 @@ const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY || '
|
||||||
export async function POST(req: Request) {
|
export async function POST(req: Request) {
|
||||||
const { email } = await req.json()
|
const { email } = await req.json()
|
||||||
|
|
||||||
analytics.identify({
|
const id = uuid()
|
||||||
anonymousId: uuid(),
|
|
||||||
|
await analytics.identify({
|
||||||
|
anonymousId: id,
|
||||||
traits: {
|
traits: {
|
||||||
email,
|
email,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await analytics.track({
|
||||||
|
anonymousId: id,
|
||||||
|
event: 'signup',
|
||||||
|
properties: {
|
||||||
|
email,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
return new Response(null, { status: 200 })
|
return new Response(null, { status: 200 })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue