-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SP1] Amplitude 설정 #189
[SP1] Amplitude 설정 #189
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다~ 얼른 트랙킹 붙여서 확인해보고 싶네요
src/hooks/useAmplitude.ts
Outdated
const AMPLITUDE_API_KEY = process.env.NEXT_PUBLIC_AMPLITUDE_API_KEY; | ||
|
||
function useAmplitude() { | ||
const [amplitude, setAmplitude] = useState<typeof import('@amplitude/analytics-browser')>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import한 값을 typeof 로 바로 지정할 수도 있군요 !!
src/hooks/useAmplitude.ts
Outdated
const [amplitude, setAmplitude] = useState<typeof import('@amplitude/analytics-browser')>(); | ||
|
||
useEffect(() => { | ||
const initAmplitude = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
init은 한 페이지에서 한 번만 불려도 될 것 같은데요 ..!!
만약 페이지 하나가 컴포넌트 3개를 거느리고 있고, 각 컴포넌트에서 useAmplitude를 호출하면, initAmplitude가 3번 호출되어서 amplitudeModule.init
도 3번 호출되고, 그러면 view_${pageName}
도 3번 찍히게 될 것 같습니다 ..!!!
(훅 관련한 기억이 긴가민가해서 틀린 추측일 수도 있습니다!)
Summary
Screenshot
[chrome extension 캡쳐]
크롬 익스텐션 설치를 권장합니다! 이벤트 로그를 편하게 볼 수 있습니다.
Comment
.env.development
,.env.production
으로 나누었습니다. 알려드린 앰플리튜드 키를 각각 넣어주세요!click_main_part
,click_main_activity
,click_review_part
이벤트를 트래킹했습니다. 참고해서 작성해주시면 됩니다.