Add PostHog analytics — full event tracking across all pages
Tracks pageviews, hero/CTA clicks, product teaser clicks, app card and detail views, newsletter signups, nav interactions, and footer link clicks with structured properties for PostHog dashboards. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
8
components/ui/NewsletterForm.tsx
Normal file → Executable file
8
components/ui/NewsletterForm.tsx
Normal file → Executable file
@@ -1,8 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { posthog } from '@/lib/posthog'
|
||||
|
||||
export default function NewsletterForm() {
|
||||
export default function NewsletterForm({ source = 'homepage' }: { source?: string }) {
|
||||
const [email, setEmail] = useState('')
|
||||
const [submitted, setSubmitted] = useState(false)
|
||||
|
||||
@@ -21,7 +22,10 @@ export default function NewsletterForm() {
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault()
|
||||
if (email.trim()) setSubmitted(true)
|
||||
if (email.trim()) {
|
||||
posthog.capture('newsletter_signup', { source })
|
||||
setSubmitted(true)
|
||||
}
|
||||
}}
|
||||
style={{ display: 'flex', gap: 12, maxWidth: 480, margin: '0 auto', flexWrap: 'wrap' }}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user