Skip to content

GA 질의 이벤트 연결 키 충돌 및 비운영 계측 차단 - #595

Merged
goder-0 merged 1 commit into
mainfrom
feature/#594-ga-query-id
Sep 9, 2026
Merged

goder-0 merged 1 commit into
mainfrom
feature/#594-ga-query-id

Conversation

@goder-0

@goder-0 goder-0 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

관련 이슈

PR 설명

브라우저에서 UUID로 보낸 query_id가 GA4 처리 과정에서 Google 내부 식별자로 치환되어 서버 질의 이벤트와 연결되지 않던 문제를 해결합니다. 아울러 로컬과 Preview 환경의 이벤트가 운영 GA 속성에 유입되지 않도록 계측 활성 조건을 명시적으로 제한합니다.

변경 사항

  • query_result_click, query_feedback의 연결 키를 app_query_id로 변경했습니다.
  • 운영 GA 측정 ID 하드코딩 fallback을 제거했습니다.
  • NEXT_PUBLIC_ANALYTICS_ENABLED=true이고 측정 ID가 설정된 경우에만 Google 태그와 이벤트 전송을 활성화합니다.
  • 환경변수 예시와 운영/비운영 설정 기준을 문서화했습니다.
  • 비활성 환경과 측정 ID 누락 환경에서 이벤트를 보내지 않는 테스트를 추가했습니다.

리뷰 포인트

  • 백엔드 PR #308과 함께 배포되어야 네 질의 이벤트가 동일한 app_query_id로 연결됩니다.
  • 배포 전 Vercel Production에만 NEXT_PUBLIC_ANALYTICS_ENABLED=true와 운영 NEXT_PUBLIC_GA_MEASUREMENT_ID를 설정해야 합니다.
  • Preview와 로컬은 두 값을 활성화하지 않는 것이 기본 동작입니다.

검증

  • 전체 단위 테스트 23개
  • ESLint 전체 검사
  • TypeScript 타입 검사

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: a4347975-6c1e-4e16-8d50-57bafd721f95

📥 Commits

Reviewing files that changed from the base of the PR and between 5636b2e and d323da7.

📒 Files selected for processing (6)
  • .env.example
  • README.md
  • src/app/(route)/chat/[id]/ChatPage.tsx
  • src/app/layout.tsx
  • src/lib/client/analytics.test.ts
  • src/lib/client/analytics.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

GA4 측정 ID와 활성화 플래그를 환경 변수로 관리합니다. 명시적으로 활성화되고 측정 ID가 있을 때만 GA4를 렌더링하고 이벤트를 전송합니다. 검색 결과 클릭과 피드백 이벤트의 식별자 필드를 query_id에서 app_query_id로 변경했습니다. 비활성화 상태와 측정 ID가 없는 상태를 테스트에 추가했습니다.

Priority: ➖ Normal — Impact reflects medium issue severity.

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to d323d

GA4 now sends events only when explicitly configured, and click and feedback events use the application query identifier for consistent attribution. No merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive 프론트엔드의 app_query_id 변경, GA fallback 제거, 명시적 활성화 조건, 환경 변수 문서화, 관련 테스트 추가는 이슈 #594의 요구사항과 일치합니다. 그러나 백엔드 이벤트가 동일한 app_query_id를 사용하는지는 백엔드 PR #308의 내용이 제공되지 않아 확인할 수 없습니다. 백엔드 PR #308에서 query_submit과 query_response_complete가 app_query_id를 사용한다는 구현 또는 검증 결과를 제공하십시오. 네 이벤트의 연결 조건과 운영·로컬 환경의 GA 동작도 함께 확인하십시오.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 GA 이벤트 연결 키 충돌 해결과 비운영 환경 계측 차단이라는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Description check ✅ Passed 설명은 템플릿의 관련 이슈와 PR 설명을 포함합니다. 변경 사항, 백엔드 연계 조건, 배포 설정, 검증 항목도 구체적으로 작성되었습니다.
Out of Scope Changes check ✅ Passed 변경 사항은 GA 이벤트 연결 키 수정, 환경별 계측 제어, 환경 변수 문서화, 테스트 갱신으로 제한됩니다. 제공된 이슈의 범위를 벗어난 변경은 확인되지 않습니다.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/#594-ga-query-id

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@goder-0
goder-0 merged commit dcaf2bb into main Sep 9, 2026
3 checks passed
@goder-0
goder-0 deleted the feature/#594-ga-query-id branch September 9, 2026 12:22
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.

[Analytics] 브라우저 질의 이벤트의 query_id 충돌 해결 및 비운영 계측 차단

2 participants