Skip to content

GA4 이벤트/퍼널 로깅 추가#74

Open
choihooo wants to merge 5 commits intomainfrom
feat/pmf-지표-로그

Hidden character warning

The head ref may contain hidden characters: "feat/pmf-\uc9c0\ud45c-\ub85c\uadf8"
Open

GA4 이벤트/퍼널 로깅 추가#74
choihooo wants to merge 5 commits intomainfrom
feat/pmf-지표-로그

Conversation

@choihooo
Copy link
Contributor

@choihooo choihooo commented Feb 9, 2026

GA4 이벤트/퍼널 로깅 추가

PMF/퍼널/리텐션 측정용으로 Electron renderer에 GA4(G-Measurement ID) 기반 이벤트 로깅을 추가했습니다.

주요 변경사항

  • GA4 초기화/전송 유틸 추가
    • src/renderer/src/shared/lib/analytics/ga4.ts: gtag.js 로드, page_view/custom event 전송, user_id 세팅 지원
    • src/renderer/src/shared/lib/analytics/events.ts: ga.md 이벤트 스펙을 함수로 래핑해 이벤트명/파라미터 일관성 확보
  • SPA 라우팅 page_view 전송
    • src/renderer/src/app/providers/App.tsx: router.subscribe() 기반으로 라우팅 변경마다 page_view 전송
  • 퍼널/핵심 이벤트 연결(ga.md 기준)
    • 가입 완료: sign_up_complete
      • src/renderer/src/entities/user/api/use-verify-email-mutation.ts
      • /auth/verify-email 응답 timestampsignupCompletedAt으로 저장(리텐션 앵커)
      • localStorage.clear() 이후에도 signupCompletedAt 및 GA 플래그 보존
    • 온보딩 진입: onboarding_enter
      • src/renderer/src/pages/onboarding-init-page/index.tsx
    • 메인 진입/자세 이벤트
      • measure_page_enter, bad_posture_enter, posture_recovered
      • src/renderer/src/pages/main-page/index.tsx
    • 세션 시작/종료
      • measure_start, first_measure_start, meaningful_use(7일 이후 1회)
      • src/renderer/src/entities/session/api/use-create-session-mutation.ts
      • measure_end
      • src/renderer/src/entities/session/api/use-stop-session-mutation.ts
    • 위젯
      • widget_toggle, widget_visibility_end
      • src/renderer/src/widgets/widget/lib/useWidget.ts
    • 알림
      • notification_toggle
      • src/renderer/src/features/notification/ui/NotificationModal.tsx
  • dev 환경에서 GA 확인 가능
    • VITE_GA_ENABLE_IN_DEV=true일 때 dev에서도 GA 활성화 + debug_mode: true
  • env 로딩 수정
    • vite.config.mts: envDir 설정으로 repo 루트 /.env를 renderer에서도 인식
  • DebugView/collect 전송 이슈 수정
    • canonical gtag stub 형태로 변경해서 google-analytics.com/g/collect 실제 전송 및 DebugView 동작

사용 방법

  • .env
    • VITE_GA_MEASUREMENT_ID=G-XXXXXXXXXX
    • (로컬 확인 시) VITE_GA_ENABLE_IN_DEV=true

테스트

  • pnpm run typecheck:renderer 통과
  • pnpm run lint:check 통과(기존 warning만 존재)

참고

  • download_click은 “다운로드 랜딩 페이지” 트리거가 이 repo에 없어 코드 연결은 제외(이벤트 스펙은 ga.md에 존재)

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

🔧 Electron Build Results

✅ macOS

✅ Windows


This is an automated comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant