@@ -28,6 +28,8 @@ import {
2828import { persistWizardState , clearWizardState } from "@/lib/wizard-storage"
2929import { WizardAnswerGrid } from "./wizard-answer-grid"
3030import { WizardConfirmationDialog } from "./wizard-confirmation-dialog"
31+ import { track } from "@/lib/mixpanel"
32+ import { ANALYTICS_EVENTS } from "@/lib/analytics-events"
3133
3234const suffixSteps = getSuffixSteps ( )
3335const buildStepSignature = ( step : WizardStep ) => `${ step . id } ::${ step . questions . map ( ( question ) => question . id ) . join ( "|" ) } `
@@ -559,6 +561,16 @@ export function InstructionsWizard({
559561 return
560562 }
561563
564+ // Track answer selection
565+ track ( ANALYTICS_EVENTS . WIZARD_ANSWER_SELECTED , {
566+ questionId : currentQuestion . id ,
567+ answerValue : answer . value ,
568+ answerLabel : answer . label ,
569+ allowMultiple : currentQuestion . allowMultiple ?? false ,
570+ isDefault : Boolean ( answer . isDefault ) ,
571+ stepId : currentStep ?. id ?? null ,
572+ } )
573+
562574 void handleQuestionAnswerSelection ( currentQuestion , answer )
563575 }
564576
@@ -704,6 +716,11 @@ export function InstructionsWizard({
704716 return
705717 }
706718
719+ track ( ANALYTICS_EVENTS . WIZARD_FREE_TEXT_SAVED , {
720+ questionId : currentQuestion . id ,
721+ length : currentFreeTextValue . trim ( ) . length ,
722+ } )
723+
707724 commitFreeTextValue ( currentQuestion , currentFreeTextValue )
708725 }
709726
@@ -712,6 +729,10 @@ export function InstructionsWizard({
712729 return
713730 }
714731
732+ track ( ANALYTICS_EVENTS . WIZARD_FREE_TEXT_CLEARED , {
733+ questionId : currentQuestion . id ,
734+ } )
735+
715736 commitFreeTextValue ( currentQuestion , "" , { allowAutoAdvance : false } )
716737 }
717738
@@ -733,6 +754,14 @@ export function InstructionsWizard({
733754
734755 const isStackQuestion = currentQuestion . id === STACK_QUESTION_ID
735756
757+ // Track default use
758+ track ( ANALYTICS_EVENTS . WIZARD_USE_DEFAULT , {
759+ questionId : currentQuestion . id ,
760+ answerValue : defaultAnswer . value ,
761+ answerLabel : defaultAnswer . label ,
762+ isStackQuestion,
763+ } )
764+
736765 if ( isStackQuestion ) {
737766 await loadStackQuestions ( defaultAnswer . value , defaultAnswer . label , {
738767 skipFastTrackPrompt : autoStartAfterStackSelection ,
@@ -769,6 +798,7 @@ export function InstructionsWizard({
769798 }
770799
771800 const requestResetWizard = ( ) => {
801+ track ( ANALYTICS_EVENTS . WIZARD_RESET )
772802 setPendingConfirmation ( "reset" )
773803 }
774804
0 commit comments