From 9da619f5bc69d4b69636a63db7c0658d46de71e9 Mon Sep 17 00:00:00 2001 From: Kangdy Date: Sat, 28 Feb 2026 22:55:04 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=EB=A7=81=ED=81=AC=20=EA=B3=B5?= =?UTF-8?q?=EC=9C=A0(share=5Flink)=20GA4=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=8A=B8=EB=9E=98=ED=82=B9=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/meeting/[id]/page.tsx | 29 ++++++++++++++++++++++++++++- app/result/[id]/page.tsx | 29 +++++++++++++++++++++++++---- components/share/shareContent.tsx | 25 ++++++++++++++++++++++++- 3 files changed, 77 insertions(+), 6 deletions(-) diff --git a/app/meeting/[id]/page.tsx b/app/meeting/[id]/page.tsx index 64b5433..7519021 100644 --- a/app/meeting/[id]/page.tsx +++ b/app/meeting/[id]/page.tsx @@ -15,6 +15,8 @@ import MeetingInfoSection from '@/components/meeting/MeetingInfoSection'; import { useToast } from '@/hooks/useToast'; import Toast from '@/components/ui/toast'; import { getMeetingUserId, removeMeetingUserId } from '@/lib/storage'; +// ⭐️ GA4 전송 함수 임포트 +import { sendGAEvent } from '@next/third-parties/google'; interface StationInfo { line: string; @@ -73,8 +75,33 @@ export default function Page() { } }, [isError, error, id]); + // GA4 전송 전용 도우미 함수 + const trackShareEvent = () => { + if (typeof window !== 'undefined') { + let browserId = localStorage.getItem('browser_id'); + if (!browserId) { + browserId = `bid_${Math.random().toString(36).substring(2, 15)}${Date.now().toString(36)}`; + localStorage.setItem('browser_id', browserId); + } + + sendGAEvent('event', 'share_link', { + meeting_url_id: id, + location: 'creation_complete', + browser_id: browserId, + }); + } + }; + + // 공유하기 버튼 전용 핸들러 const handleShareClick = (e: React.MouseEvent) => { openModal('SHARE', { meetingId: id }, e); + trackShareEvent(); + }; + + // 재촉하기 버튼 전용 핸들러 + const handleNudgeClick = (e: React.MouseEvent) => { + openModal('NUDGE', { meetingId: id }, e); + trackShareEvent(); }; const handleSelectStation = (stationName: string | null) => { @@ -244,7 +271,7 @@ export default function Page() {