Skip to content

chore: GA 이벤트 수집 방법 변경#488

Draft
seongminn wants to merge 1 commit intowip-v2from
ga-event
Draft

chore: GA 이벤트 수집 방법 변경#488
seongminn wants to merge 1 commit intowip-v2from
ga-event

Conversation

@seongminn
Copy link
Copy Markdown
Member

✅ 작업 내용

  • GA 이벤트가 안들어온다고 하셔서 인자 넘기는 방법을 수정해봤습니다.
  • 기획자 분께서 아직 확인을 안해주셔서 드래프트 해놓고 확인 완료되면 승인 요청 드릴게요!

📝 참고 자료

  • 작업한 내용에 대한 부연 설명

♾️ 기타

  • 추가로 필요한 작업 내용

@seongminn seongminn marked this pull request as draft April 13, 2026 11:50
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spectator Ready Ready Preview, Comment Apr 13, 2026 11:50am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
manager Skipped Skipped Apr 13, 2026 11:50am

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the useTracker hook to accept a single event object instead of rest parameters and updates the sendGAEvent call. Feedback points out that sendGAEvent requires a single object with an event property to function correctly with Google Tag Manager and highlights that the signature change is a breaking change for existing implementations.

Comment on lines +10 to +11
return ({ action, value }: GAEventParams) =>
sendGAEvent('event', `${category} ${action}`, { value });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

@next/third-parties/google 라이브러리의 sendGAEvent 함수는 내부적으로 window.dataLayer.push를 호출하는 래퍼입니다. GTM(Google Tag Manager)이나 GA4에서 이벤트를 정상적으로 수집하려면 event 속성을 포함한 단일 객체를 인자로 전달해야 합니다. 현재처럼 여러 개의 인자를 개별적으로 전달하면 GTM에서 이벤트를 인식하지 못해 데이터가 누락됩니다.

또한, 함수의 시그니처가 가변 인자(...value)에서 단일 객체({ action, value })로 변경되었습니다. 이 훅을 사용하는 기존 코드들에서 타입 오류나 런타임 에러가 발생할 수 있는 파괴적 변경(Breaking Change)이므로 주의가 필요합니다.

참고로 GA4에서 value 파라미터는 주로 수치형 데이터를 위해 예약되어 있으므로, 문자열 정보를 전달할 때는 다른 파라미터 이름을 사용하거나 이벤트 명에 포함시키는 것이 좋습니다.

Suggested change
return ({ action, value }: GAEventParams) =>
sendGAEvent('event', `${category} ${action}`, { value });
return ({ action, value }: GAEventParams) =>
sendGAEvent({ event: `${category} ${action}`, value });

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