From 1343d261e214be3f00c3172189204bef5726f0e4 Mon Sep 17 00:00:00 2001 From: YOOJS1205 Date: Wed, 7 Jan 2026 18:35:15 +0900 Subject: [PATCH] =?UTF-8?q?ga=20event=EB=A5=BC=20=EC=8B=AC=EB=8A=94?= =?UTF-8?q?=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 4 +++- src/api/useKakaoShareUrl.ts | 3 +++ src/components/common/LinkShareBottomSheet/hooks.ts | 2 ++ .../poll/regist/PollRegistButton/PollRegistButton.tsx | 5 +++++ src/pages/Home/Home.tsx | 2 ++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 28d97a74..2f390167 100644 --- a/index.html +++ b/index.html @@ -37,7 +37,9 @@ dataLayer.push(arguments); } gtag('js', new Date()); - gtag('config', 'G-H3ZTJT4LNW'); + gtag('config', 'G-H3ZTJT4LNW', { + debug_mode: true, + }); diff --git a/src/api/useKakaoShareUrl.ts b/src/api/useKakaoShareUrl.ts index 7e6173f1..19d71beb 100644 --- a/src/api/useKakaoShareUrl.ts +++ b/src/api/useKakaoShareUrl.ts @@ -1,4 +1,5 @@ import { useEffect } from 'react'; +import ReactGA from 'react-ga4'; import { useBottomSheet } from '@/components/common/BottomSheet/hooks'; interface KakaoShareUrlProps { author: string; @@ -21,6 +22,8 @@ export function useKakaoShareUrl({ author, shareUrl }: KakaoShareUrlProps) { } try { + ReactGA.event('poll_shared'); + window.Kakao.Share.sendDefault({ objectType: 'feed', content: { diff --git a/src/components/common/LinkShareBottomSheet/hooks.ts b/src/components/common/LinkShareBottomSheet/hooks.ts index a972637d..9759362d 100644 --- a/src/components/common/LinkShareBottomSheet/hooks.ts +++ b/src/components/common/LinkShareBottomSheet/hooks.ts @@ -1,3 +1,4 @@ +import ReactGA from 'react-ga4'; import useToast from '../Toast/hooks'; import useGetMyInfo from '@/api/useGetMyInfo'; import { useKakaoShareUrl } from '@/api/useKakaoShareUrl'; @@ -22,6 +23,7 @@ export default function useLinkShareBottomSheet({ navigator.clipboard .writeText(shareUrl) .then(() => { + ReactGA.event('poll_shared'); toast.success({ title: '투표 주소가 복사됐어요!😉', }); diff --git a/src/components/poll/regist/PollRegistButton/PollRegistButton.tsx b/src/components/poll/regist/PollRegistButton/PollRegistButton.tsx index 74546a25..0541cb28 100644 --- a/src/components/poll/regist/PollRegistButton/PollRegistButton.tsx +++ b/src/components/poll/regist/PollRegistButton/PollRegistButton.tsx @@ -28,6 +28,11 @@ export default function PollRegistButton() { onboardingStep: { ...myInfo.onboardingStep, FIRST_VOTE: false }, }); } + + ReactGA.event('every_poll_created', { + post_id: data.postId, + }); + const shareUrl = `${window.location.origin}/posts/${data.postId}?shareUrl=${data.shareUrl}`; navigate(`/posts/${data.postId}`); openBottomSheet(); diff --git a/src/pages/Home/Home.tsx b/src/pages/Home/Home.tsx index 854628b7..dcdf73ca 100644 --- a/src/pages/Home/Home.tsx +++ b/src/pages/Home/Home.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from 'react'; +import ReactGA from 'react-ga4'; import { useNavigate } from 'react-router-dom'; import useGetMyInfo from '@/api/useGetMyInfo'; import { useGetNotificationPresent } from '@/api/useGetNotificationPresent'; @@ -19,6 +20,7 @@ export default function Home() { const [isCoachMarkClosed, setIsCoachMarkClosed] = useState(false); const handleCloseCoachMark = () => { + ReactGA.event('user_signup'); setIsCoachMarkClosed(true); if (myInfo?.onboardingStep) { updateOnboarding.mutate({