@@ -8,6 +8,7 @@ import { toast } from 'sonner';
88import { useRouter } from 'next/navigation' ;
99import Loading from '@/components/CenterLoader' ;
1010import ProfileHover from '@/components/ProfileIcon' ;
11+ import { posthog } from '@/lib/posthog' ;
1112
1213export default function FindMatchPage ( ) {
1314 const [ isSearching , setIsSearching ] = useState ( false ) ;
@@ -165,6 +166,7 @@ export default function FindMatchPage() {
165166 setPeerProfile ( null ) ;
166167 setCurrentQuote ( 0 ) ;
167168 socket . emit ( 'match:start' , { skills } ) ;
169+ posthog . capture ( 'match_search_started' , { skill_count : skills . length } ) ;
168170 } catch {
169171 toast . error ( 'Unable to start matching' ) ;
170172 }
@@ -201,6 +203,7 @@ export default function FindMatchPage() {
201203 setPeerId ( peerId ) ;
202204 setIsSearching ( false ) ;
203205 setMatchFound ( true ) ;
206+ posthog . capture ( 'match_found' , { session_id : sessionId } ) ;
204207 } ;
205208
206209 socket . on ( 'match:found' , onMatchFound ) ;
@@ -229,6 +232,7 @@ export default function FindMatchPage() {
229232 clearInterval ( autoJoinRef . current ) ;
230233 autoJoinRef . current = null ;
231234 }
235+ posthog . capture ( 'match_accepted' ) ;
232236 router . push ( `/session?callId=${ sessionId } &peerId=${ peerId } ` ) ;
233237 } ;
234238
@@ -238,6 +242,7 @@ export default function FindMatchPage() {
238242 autoJoinRef . current = null ;
239243 }
240244 socket . emit ( 'match:decline' , { sessionId, peerId } ) ;
245+ posthog . capture ( 'match_declined' ) ;
241246 setMatchFound ( false ) ;
242247 setSessionId ( null ) ;
243248 setPeerId ( null ) ;
0 commit comments