11'use client'
22
3+ import { AnalyticsEvent } from '@codebuff/common/constants/analytics-events'
34import { AnimatePresence , motion } from 'framer-motion'
45import {
56 ChevronDown ,
@@ -9,6 +10,7 @@ import {
910} from 'lucide-react'
1011import Image from 'next/image'
1112import Link from 'next/link'
13+ import posthog from 'posthog-js'
1214import { useEffect , useState } from 'react'
1315
1416import { BackgroundBeams } from '@/components/background-beams'
@@ -98,7 +100,10 @@ export default function GetStartedClient({
98100
99101 useEffect ( ( ) => {
100102 setOs ( detectOS ( ) )
101- } , [ ] )
103+ posthog . capture ( AnalyticsEvent . FREEBUFF_GET_STARTED_VIEWED , {
104+ referrer : referrerName ,
105+ } )
106+ } , [ referrerName ] )
102107
103108 return (
104109 < div className = "relative min-h-screen" >
@@ -145,7 +150,7 @@ export default function GetStartedClient({
145150 </ motion . div >
146151
147152 { /* Main content */ }
148- < div className = "relative z-10 container mx-auto px-4 pt-28 pb-16 md:pt-36 md:pb-24 flex flex-col items-center" >
153+ < div className = "relative z-10 container mx-auto px-4 pt-16 pb-16 md:pt-36 md:pb-24 flex flex-col items-center" >
149154 < div className = "w-full max-w-2xl" >
150155 < div className = "bg-background/80 backdrop-blur-sm border border-zinc-800 rounded-xl overflow-hidden" >
151156 { /* Header */ }
@@ -180,7 +185,14 @@ export default function GetStartedClient({
180185 { /* Collapsible help */ }
181186 < div className = "rounded-lg overflow-hidden" >
182187 < button
183- onClick = { ( ) => setHelpExpanded ( ! helpExpanded ) }
188+ onClick = { ( ) => {
189+ if ( ! helpExpanded ) {
190+ posthog . capture (
191+ AnalyticsEvent . FREEBUFF_GET_STARTED_HELP_EXPANDED ,
192+ )
193+ }
194+ setHelpExpanded ( ! helpExpanded )
195+ } }
184196 className = "w-full flex items-center justify-between px-4 py-3 text-sm text-muted-foreground hover:text-foreground hover:bg-zinc-800/50 transition-colors cursor-pointer"
185197 >
186198 < span > Need help setting up?</ span >
@@ -210,9 +222,16 @@ export default function GetStartedClient({
210222 </ p >
211223 < div className = "grid grid-cols-2 gap-2" >
212224 { editors . map ( ( editor ) => (
213- < div
225+ < button
214226 key = { editor . name }
215- className = "flex items-center gap-2 px-3 py-2 bg-zinc-800/60 border border-zinc-700/40 rounded-lg hover:border-zinc-600 transition-colors duration-200 cursor-default"
227+ type = "button"
228+ className = "flex items-center gap-2 px-3 py-2 bg-zinc-800/60 border border-zinc-700/40 rounded-lg hover:border-zinc-600 transition-colors duration-200 cursor-pointer"
229+ onClick = { ( ) =>
230+ posthog . capture (
231+ AnalyticsEvent . FREEBUFF_GET_STARTED_EDITOR_CLICKED ,
232+ { editor : editor . name } ,
233+ )
234+ }
216235 >
217236 < div
218237 className = { cn (
@@ -231,7 +250,7 @@ export default function GetStartedClient({
231250 < span className = "text-sm font-medium text-zinc-200" >
232251 { editor . name }
233252 </ span >
234- </ div >
253+ </ button >
235254 ) ) }
236255 </ div >
237256 </ div >
0 commit comments