-
Notifications
You must be signed in to change notification settings - Fork 1
chore: Google Analytics 기본 세팅 및 모임 생성(create) 이벤트 설정 #45
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import { useCreateMeeting } from '@/hooks/api/mutation/useCreateMeeting'; | |
| import type { MeetingCreateRequest } from '@/types/api'; | ||
| import { useToast } from '@/hooks/useToast'; | ||
| import Toast from '@/components/ui/toast'; | ||
| import { sendGAEvent } from '@next/third-parties/google'; | ||
|
|
||
| export default function Page() { | ||
| const [meetingName, setMeetingName] = useState(''); | ||
|
|
@@ -123,7 +124,7 @@ export default function Page() { | |
|
|
||
| const purposes = getPurposes(); | ||
|
|
||
| // capacity 처리: "아직 안정해졌어요" 체크 시 30으로 설정 | ||
| // capacity 처리: "아직 안정해졌어요" 체크 시 10으로 설정 | ||
| const capacity = isParticipantUndecided ? 10 : participantCount || 1; | ||
|
|
||
| const requestData: MeetingCreateRequest = { | ||
|
|
@@ -142,6 +143,27 @@ export default function Page() { | |
| const { meetingId } = result.data; | ||
| console.log('생성된 ID:', meetingId); | ||
|
|
||
| // --- [GA4 이벤트 전송 로직 추가] --- | ||
| if (typeof window !== 'undefined') { | ||
| // 1. 브라우저 식별자(browser_id) 확인 및 생성 (Get or Create) | ||
| let browserId = localStorage.getItem('browser_id'); | ||
| if (!browserId) { | ||
| // 없으면 새로 발급해서 브라우저에 각인! | ||
| const randomStr = Math.random().toString(36).substring(2, 15); | ||
| browserId = `bid_${randomStr}${Date.now().toString(36)}`; | ||
| localStorage.setItem('browser_id', browserId); | ||
| } | ||
|
|
||
| // 2. 방 만든 브라우저가 누구인지 식별자를 담아서 이벤트 전송 | ||
| sendGAEvent('event', 'url_created', { | ||
| meeting_url_id: meetingId, | ||
| participant_count_expected: capacity, | ||
| browser_id: browserId, | ||
| entry_method: 'url_direct', | ||
| }); | ||
| } | ||
| // ----------------------------------- | ||
|
|
||
| // purposes를 localStorage에 저장 (장소 추천 카테고리로 사용) | ||
| const purposes = getPurposes(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 불필요한 Line 125에서 이미 🔧 제안하는 수정- // purposes를 localStorage에 저장 (장소 추천 카테고리로 사용)
- const purposes = getPurposes();
- if (purposes.length > 0) {
+ // purposes를 localStorage에 저장 (장소 추천 카테고리로 사용)
+ if (purposes.length > 0) {Line 125의 🤖 Prompt for AI Agents |
||
| if (purposes.length > 0) { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
browser_id기반 추적 전 사용자 동의(GDPR/CCPA) 누락browser_id를 사용자 동의 없이localStorage에 저장하고 GA에 전송하는 것은 GDPR·CCPA 위반 소지가 있습니다. 이 식별자는 브라우저 수준에서 사용자를 추적하기 위한 목적으로 생성되므로, 쿠키/추적 동의와 동일하게 취급되어야 합니다.사용자가 동의를 제공한 이후에만
browser_id를 생성·저장·전송하거나, 동의 관리 플랫폼(CMP)을 통해 GA 자체를 조건부로 로드하는 방식을 고려하세요.🤖 Prompt for AI Agents