Skip to content

Commit a0018e8

Browse files
committed
임시커밋: 꼭 어디까지 작업했는지 확인할 것!
1 parent b7cc26a commit a0018e8

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/app/(home)/goal/create-onboard/page.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { GoalMutation } from '@/model/goal/queries';
1414
import { GoalQueryKeys } from '@/model/goal/queryKeys';
1515
import { userApi, UserQueryKeys } from '@/model/user';
1616
import { 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';
1719
import { CreateGoalFormElement } from '@/feature/goal';
1820
import type { GoalFormType } from '@/feature/goal';
1921
import 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
};

src/shared/constants/gtm-events.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export enum GTM_EVENTS {
1414
// 목표 관련
1515
GOAL_ADD = 'goal_add',
1616
GOAL_ADD_CLICK = 'goal_add_click',
17+
GOAL_START = 'goal_start',
1718
GOAL_START_CLICK = 'goal_start_click',
1819
GOAL_CLICK = 'goal_click',
1920

@@ -50,6 +51,15 @@ export enum GTM_BUTTON_NAME {
5051
GOAL_ADD_START_DATE = 'start_date',
5152
GOAL_ADD_END_DATE = 'end_date',
5253

54+
// 목표 시작(온보딩) 페이지
55+
GOAL_START_START = 'start',
56+
GOAL_START_NAME = 'name',
57+
GOAL_START_NAME_NEXT = 'name_next',
58+
GOAL_START_START_DATE = 'start_date',
59+
GOAL_START_END_DATE = 'end_date',
60+
GOAL_START_DATE_NEXT = 'date_next',
61+
GOAL_START_DONE = 'done',
62+
5363
// 목표 페이지
5464
CATEGORY_STUDY = 'category_study',
5565
CATEGORY_INVEST = 'category_invest',

0 commit comments

Comments
 (0)