diff --git a/src/common/components/Button/AmplitudeEventTrack.tsx b/src/common/components/Button/AmplitudeEventTrack.tsx new file mode 100644 index 00000000..620154e2 --- /dev/null +++ b/src/common/components/Button/AmplitudeEventTrack.tsx @@ -0,0 +1,13 @@ +import { track } from '@amplitude/analytics-browser'; +import type { ReactNode } from 'react'; + +interface AmplitudeEventTrackProps { + eventName?: string; // amplitude event name + children: ReactNode; +} + +const AmplitudeEventTrack = ({ eventName, children }: AmplitudeEventTrackProps) => { + return
(eventName ? track(eventName) : null)}>{children}
; +}; + +export default AmplitudeEventTrack; diff --git a/src/common/components/Button/index.tsx b/src/common/components/Button/index.tsx index 80ae6874..03968c56 100644 --- a/src/common/components/Button/index.tsx +++ b/src/common/components/Button/index.tsx @@ -5,10 +5,12 @@ import { useDeviceType } from 'contexts/DeviceTypeProvider'; import ButtonLoading from 'views/loadings/ButtonLoading'; import { buttonFontVar, container, outsideBox, paddings } from './style.css'; +import AmplitudeEventTrack from './AmplitudeEventTrack'; interface ButtonProps extends ButtonHTMLAttributes { children?: ReactNode; className?: string; + eventName?: string; buttonStyle?: 'solid' | 'line'; isLoading?: boolean; padding?: '15x32' | '13x20' | '10x24' | '15x25'; @@ -19,6 +21,7 @@ interface ButtonProps extends ButtonHTMLAttributes -
- {isLoading ? : children} -
- + + +
+ {isLoading ? : children} +
+
+
); }; diff --git a/src/common/components/Layout/components/Header/Nav/MenuItem/index.tsx b/src/common/components/Layout/components/Header/Nav/MenuItem/index.tsx index e56094ba..3fdc2993 100644 --- a/src/common/components/Layout/components/Header/Nav/MenuItem/index.tsx +++ b/src/common/components/Layout/components/Header/Nav/MenuItem/index.tsx @@ -1,9 +1,9 @@ -import { track } from '@amplitude/analytics-browser'; import { NavLink } from 'react-router-dom'; import { useDeviceType } from 'contexts/DeviceTypeProvider'; import { menuItemVar, menuLinkVar } from './style.css'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; interface MenuItemProps { text: string; @@ -20,13 +20,11 @@ const MenuItem = ({ text, path, target, amplitudeId, className, onClick }: MenuI return (
  • {path ? ( - (amplitudeId ? track(amplitudeId) : null)} - target={target}> - {text} - + + + {text} + + ) : (

    {text} diff --git a/src/common/components/Layout/components/Header/Nav/MenuList/index.tsx b/src/common/components/Layout/components/Header/Nav/MenuList/index.tsx index 251f94fa..f2f855cb 100644 --- a/src/common/components/Layout/components/Header/Nav/MenuList/index.tsx +++ b/src/common/components/Layout/components/Header/Nav/MenuList/index.tsx @@ -1,4 +1,4 @@ -import { reset, track } from '@amplitude/analytics-browser'; +import { reset } from '@amplitude/analytics-browser'; import { useEffect, useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; @@ -8,6 +8,7 @@ import { useRecruitingInfo } from 'contexts/RecruitingInfoProvider'; import { dimmedBgVar, menuContainerVar, menuList, menuMobListVar } from './style.css'; import { MENU_ITEMS, MENU_ITEMS_MAKERS } from '../../contants'; import MenuItem from '../MenuItem'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; const MenuList = ({ isMenuOpen, onClickMenuToggle }: { isMenuOpen?: boolean; onClickMenuToggle?: () => void }) => { const { deviceType } = useDeviceType(); @@ -34,7 +35,6 @@ const MenuList = ({ isMenuOpen, onClickMenuToggle }: { isMenuOpen?: boolean; onC } = useRecruitingInfo(); const menuItems = isMakers ? MENU_ITEMS_MAKERS : MENU_ITEMS; const handleLogout = () => { - track('click-gnb-logout'); reset(); localStorage.removeItem('soptApplyAccessToken'); localStorage.removeItem('soptApplyAccessTokenExpiredTime'); @@ -59,7 +59,9 @@ const MenuList = ({ isMenuOpen, onClickMenuToggle }: { isMenuOpen?: boolean; onC {menuItems.map(({ text, path, target, amplitudeId }) => ( ))} - + + + )} diff --git a/src/views/ApplyPage/components/ApplyHeader/index.tsx b/src/views/ApplyPage/components/ApplyHeader/index.tsx index 44b370bd..af96fea4 100644 --- a/src/views/ApplyPage/components/ApplyHeader/index.tsx +++ b/src/views/ApplyPage/components/ApplyHeader/index.tsx @@ -25,7 +25,12 @@ const ApplyHeader = ({ isLoading, onSaveDraft, onSubmitData, isReview = false }: {!isReview && deviceType !== 'MOB' && (

    - + ); diff --git a/src/views/ErrorPage/components/NoMore/index.tsx b/src/views/ErrorPage/components/NoMore/index.tsx index d331940e..a942fa75 100644 --- a/src/views/ErrorPage/components/NoMore/index.tsx +++ b/src/views/ErrorPage/components/NoMore/index.tsx @@ -1,8 +1,7 @@ -import { track } from '@amplitude/analytics-browser'; - import { useDeviceType } from 'contexts/DeviceTypeProvider'; import { article, contactButtonVar, container, errorButtonVar, errorTextVar, instructionVar } from '../../style.css'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; interface NoMoreProps { isMakers?: boolean; @@ -16,25 +15,27 @@ const NoMore = ({ isMakers, content }: NoMoreProps) => {
    +

    {`문의사항이 있다면\n아래 ‘문의하기’를 이용해 주세요`}

    + track(isMakers ? 'click-nomore-official_makers' : 'click-nomore-official')}> - 공식 홈페이지 가기 + className={contactButtonVar[deviceType]}> + 문의하기 - -

    {`문의사항이 있다면\n아래 ‘문의하기’를 이용해 주세요`}

    - track(isMakers ? 'click-nomore-ask_makers' : 'click-nomore-ask')}> - 문의하기 - +
    ); }; diff --git a/src/views/ErrorPage/index.tsx b/src/views/ErrorPage/index.tsx index 5048c90a..f67dc746 100644 --- a/src/views/ErrorPage/index.tsx +++ b/src/views/ErrorPage/index.tsx @@ -1,4 +1,3 @@ -import { track } from '@amplitude/analytics-browser'; import { useNavigate } from 'react-router-dom'; import { useDeviceType } from 'contexts/DeviceTypeProvider'; @@ -6,6 +5,7 @@ import { useDeviceType } from 'contexts/DeviceTypeProvider'; import ErrorCode from './components/ErrorCode'; import { ERROR_MESSAGE } from './constants'; import { article, contactButtonVar, container, errorButtonVar, errorTextVar, instructionVar } from './style.css'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; const ErrorPage = ({ code }: { code: 404 | 500 }) => { const { deviceType } = useDeviceType(); @@ -22,7 +22,6 @@ const ErrorPage = ({ code }: { code: 404 | 500 }) => { }; const handleClickErrorButton = () => { - code === 404 ? track('click-error-home') : track('click-error-back'); handleGoBack(code); }; @@ -33,23 +32,26 @@ const ErrorPage = ({ code }: { code: 404 | 500 }) => {

    {ERROR_MESSAGE[CODE_KEY]?.text}

    - + + +

    {`문제가 지속적으로 발생하거나 문의사항이 있다면\n아래 ‘문의하기’를 이용해 주세요`}

    - track('click-error-ask')}> - 문의하기 - + + + 문의하기 + + ); }; diff --git a/src/views/MyPage/index.tsx b/src/views/MyPage/index.tsx index 3d1a8399..d2c7235a 100644 --- a/src/views/MyPage/index.tsx +++ b/src/views/MyPage/index.tsx @@ -1,4 +1,3 @@ -import { track } from '@amplitude/analytics-browser'; import { lazy } from 'react'; import Button from '@components/Button'; @@ -39,12 +38,7 @@ const StatusButton = ({ label, to, trackingEvent }: { label: string; to: string; return (
  • {label} -
  • diff --git a/src/views/PasswordPage/components/PasswordForm/index.tsx b/src/views/PasswordPage/components/PasswordForm/index.tsx index 63506f85..a5750a99 100644 --- a/src/views/PasswordPage/components/PasswordForm/index.tsx +++ b/src/views/PasswordPage/components/PasswordForm/index.tsx @@ -1,4 +1,3 @@ -import { track } from '@amplitude/analytics-browser'; import { lazy } from 'react'; import { FormProvider, useForm, type FieldValues } from 'react-hook-form'; @@ -76,7 +75,7 @@ const PasswordForm = () => { isLoading={changePasswordIsPending} type="submit" style={{ marginTop: 30 }} - onClick={() => track('click-password-password')}> + eventName="click-password-password"> 저장하기 diff --git a/src/views/ResultPage/components/FinalResult.tsx b/src/views/ResultPage/components/FinalResult.tsx index 0424de81..66a8b001 100644 --- a/src/views/ResultPage/components/FinalResult.tsx +++ b/src/views/ResultPage/components/FinalResult.tsx @@ -1,4 +1,3 @@ -import { track } from '@amplitude/analytics-browser'; import { format } from 'date-fns/format'; import { ko } from 'date-fns/locale/ko'; import { useEffect } from 'react'; @@ -23,6 +22,7 @@ import IconMakersLogo from '../assets/IconMakersLogo'; import imgSoptLogo from '../assets/imgSoptLogo.png'; import imgSoptLogoWebp from '../assets/imgSoptLogo.webp'; import useGetFinalResult from '../hooks/useGetFinalResult'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; const Content = ({ pass }: { pass?: boolean }) => { const { deviceType } = useDeviceType(); @@ -56,14 +56,15 @@ const Content = ({ pass }: { pass?: boolean }) => { `} {`( 구글폼 : `} - track('click-final-google_form')}> - {`https://${deviceType !== 'DESK' ? '\n' : ''}${import.meta.env.VITE_FINAL_PASS_LINK}`} - + + + {`https://${deviceType !== 'DESK' ? '\n' : ''}${import.meta.env.VITE_FINAL_PASS_LINK}`} + + {` )\n`}
    diff --git a/src/views/ResultPage/components/ScreeningResult.tsx b/src/views/ResultPage/components/ScreeningResult.tsx index fdbeab74..11bf8394 100644 --- a/src/views/ResultPage/components/ScreeningResult.tsx +++ b/src/views/ResultPage/components/ScreeningResult.tsx @@ -1,4 +1,3 @@ -import { track } from '@amplitude/analytics-browser'; import { format } from 'date-fns/format'; import { ko } from 'date-fns/locale/ko'; import { useEffect } from 'react'; @@ -23,6 +22,7 @@ import IconMakersLogo from '../assets/IconMakersLogo'; import imgSoptLogo from '../assets/imgSoptLogo.png'; import imgSoptLogoWebp from '../assets/imgSoptLogo.webp'; import useGetScreeningResult from '../hooks/useGetScreeningResult'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; const Content = ({ pass }: { pass?: boolean }) => { const { deviceType } = useDeviceType(); @@ -63,14 +63,15 @@ const Content = ({ pass }: { pass?: boolean }) => { `} {`( 구글폼 : `} - track('click-screening-google_form')}> - {`https://${deviceType !== 'DESK' ? '\n' : ''}${import.meta.env.VITE_SCREENING_PASS_LINK}`} - + + + {`https://${deviceType !== 'DESK' ? '\n' : ''}${import.meta.env.VITE_SCREENING_PASS_LINK}`} + + {` )\n`}
    diff --git a/src/views/SignInPage/components/SignInForm/index.tsx b/src/views/SignInPage/components/SignInForm/index.tsx index e9aa0e59..d376c72e 100644 --- a/src/views/SignInPage/components/SignInForm/index.tsx +++ b/src/views/SignInPage/components/SignInForm/index.tsx @@ -1,4 +1,3 @@ -import { track } from '@amplitude/analytics-browser'; import { type FieldValues, FormProvider, useForm } from 'react-hook-form'; import { Link } from 'react-router-dom'; @@ -9,6 +8,7 @@ import { useRecruitingInfo } from 'contexts/RecruitingInfoProvider'; import useMutateSignIn from 'views/SignInPage/hooks/useMutateSignIn'; import { inputWrapper, newPasswordButton } from './style.css'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; const SignInForm = () => { const { @@ -61,12 +61,14 @@ const SignInForm = () => { />

    비밀번호를 잃어버리셨나요?

    - track('click-signin-password')}> - 비밀번호 재설정하기 - + + + 비밀번호 재설정하기 + +
    - diff --git a/src/views/SignInPage/components/SignInInfo/index.tsx b/src/views/SignInPage/components/SignInInfo/index.tsx index 05dafa53..80f6ff0f 100644 --- a/src/views/SignInPage/components/SignInInfo/index.tsx +++ b/src/views/SignInPage/components/SignInInfo/index.tsx @@ -1,4 +1,3 @@ -import { track } from '@amplitude/analytics-browser'; import { Link } from 'react-router-dom'; import Callout from '@components/Callout'; @@ -7,6 +6,7 @@ import { useDeviceType } from 'contexts/DeviceTypeProvider'; import { useRecruitingInfo } from 'contexts/RecruitingInfoProvider'; import { calloutButtonVar } from './style.css'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; const SignInInfo = () => { const { deviceType } = useDeviceType(); @@ -21,9 +21,11 @@ const SignInInfo = () => { track('click-signin-signup')}> - 새 지원서 작성하기 - + + + 새 지원서 작성하기 + + }>

    {season}기 {isMakers ? '' : group} 지원서 작성이 처음이라면 ‘새 지원서 작성하기’를 진행해주세요. 이전에 diff --git a/src/views/SignupPage/components/SignupForm/index.tsx b/src/views/SignupPage/components/SignupForm/index.tsx index d505ccf2..d5f96de4 100644 --- a/src/views/SignupPage/components/SignupForm/index.tsx +++ b/src/views/SignupPage/components/SignupForm/index.tsx @@ -1,4 +1,3 @@ -import { track } from '@amplitude/analytics-browser'; import { lazy, useEffect } from 'react'; import { type FieldValues, FormProvider, useForm } from 'react-hook-form'; @@ -101,11 +100,7 @@ const SignupForm = () => { {PRIVACY_POLICY} - diff --git a/src/views/dialogs/SessionExpiredDialog/index.tsx b/src/views/dialogs/SessionExpiredDialog/index.tsx index 0b4addc6..824a2f4b 100644 --- a/src/views/dialogs/SessionExpiredDialog/index.tsx +++ b/src/views/dialogs/SessionExpiredDialog/index.tsx @@ -1,10 +1,10 @@ -import { track } from '@amplitude/analytics-browser'; import { forwardRef, type KeyboardEvent } from 'react'; import Dialog from '@components/Dialog'; import { useDeviceType } from 'contexts/DeviceTypeProvider'; import { buttonInside, buttonOutside, buttonOutsideVar, buttonWrapperVar, mainTextVar, subTextVar } from '../style.css'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; const SessionExpiredDialog = forwardRef((_, ref) => { const { deviceType } = useDeviceType(); @@ -14,7 +14,6 @@ const SessionExpiredDialog = forwardRef((_, ref) => { }; const handleLogout = () => { - track('click-session-okay'); localStorage.removeItem('soptApplyAccessToken'); localStorage.removeItem('soptApplyAccessTokenExpiredTime'); if (window.location.pathname === '/') { @@ -31,9 +30,11 @@ const SessionExpiredDialog = forwardRef((_, ref) => {

    - + + +
    ); diff --git a/src/views/dialogs/SubmitDialog/index.tsx b/src/views/dialogs/SubmitDialog/index.tsx index 2f3a686c..70bc26dc 100644 --- a/src/views/dialogs/SubmitDialog/index.tsx +++ b/src/views/dialogs/SubmitDialog/index.tsx @@ -1,4 +1,3 @@ -import { track } from '@amplitude/analytics-browser'; import { type ChangeEvent, forwardRef, useState } from 'react'; import Dialog from '@components/Dialog'; @@ -16,6 +15,7 @@ import { infoWrapperVar, } from './style.css'; import { buttonInside, buttonOutside, buttonOutsideVar, buttonWrapperVar, mainTextVar, subTextVar } from '../style.css'; +import AmplitudeEventTrack from '@components/Button/AmplitudeEventTrack'; const MyInfoItem = ({ deviceType, @@ -82,14 +82,18 @@ const SubmitDialog = forwardRef( method="dialog" className={`${dataIsPending ? buttonOutside.disabled : buttonOutside.line} ${buttonOutsideVar[deviceType]}`} onSubmit={() => setIsChecked(false)}> - + + +
    - + + +