@@ -14,6 +14,8 @@ import { GoalMutation } from '@/model/goal/queries';
1414import { GoalQueryKeys } from '@/model/goal/queryKeys' ;
1515import { userApi , UserQueryKeys } from '@/model/user' ;
1616import { useToast } from '@/shared/components/feedBack/toast' ;
17+ import { useGTMActions } from '@/shared/hooks/useGTM' ;
18+ import { GTM_BUTTON_NAME , GTM_EVENTS } from '@/shared/constants/gtm-events' ;
1719import { CreateGoalFormElement } from '@/feature/goal' ;
1820import type { GoalFormType } from '@/feature/goal' ;
1921import type { CreateGoalResponseType } from '@/model/goal/dto' ;
@@ -38,6 +40,7 @@ function GoalOnboardContent() {
3840 const queryClient = useQueryClient ( ) ;
3941 const { showToast } = useToast ( ) ;
4042 const { fullUserName } = useFetchUserName ( ) ;
43+ const { trackButtonClick } = useGTMActions ( ) ;
4144
4245 const [ currentStep , setCurrentStep ] = useState ( 1 ) ;
4346 const [ createdGoalData , setCreatedGoalData ] = useState < CreateGoalResponseType | null > ( null ) ;
@@ -89,9 +92,19 @@ function GoalOnboardContent() {
8992 }
9093 } ;
9194
95+ const stepButtonMap : Record < number , string > = {
96+ 1 : GTM_BUTTON_NAME . GOAL_START_START ,
97+ 2 : GTM_BUTTON_NAME . GOAL_START_NAME_NEXT ,
98+ 3 : GTM_BUTTON_NAME . GOAL_START_DATE_NEXT ,
99+ } ;
100+
92101 const handleNext = ( ) => {
93102 if ( ! validateStep ( ) ) return ;
94103
104+ if ( stepButtonMap [ currentStep ] ) {
105+ trackButtonClick ( { eventName : GTM_EVENTS . GOAL_START , buttonName : stepButtonMap [ currentStep ] } ) ;
106+ }
107+
95108 if ( currentStep === 1 ) {
96109 // 온보딩 등록 API 호출
97110 updateOnboardStatus ( ) ;
@@ -124,6 +137,7 @@ function GoalOnboardContent() {
124137 } ;
125138
126139 const handleComplete = ( ) => {
140+ trackButtonClick ( { eventName : GTM_EVENTS . GOAL_START , buttonName : GTM_BUTTON_NAME . GOAL_START_DONE } ) ;
127141 router . push ( ROUTES . HOME ) ;
128142 showToast ( '목표 생성이 완료되었습니다.' , 'success' ) ;
129143 } ;
0 commit comments