web: newsletter signup on download page

This commit is contained in:
Jeffrey Morgan
2023-07-12 17:26:20 -07:00
parent 5571ed5248
commit 4c2b4589ac
8 changed files with 340 additions and 25 deletions

View File

@@ -0,0 +1,17 @@
import { Analytics } from '@segment/analytics-node'
import { v4 as uuid } from 'uuid'
const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY || '<empty>' })
export async function POST(req: Request) {
const { email } = await req.json()
analytics.identify({
anonymousId: uuid(),
traits: {
email,
},
})
return new Response(null, { status: 200 })
}