Skip to content

Commit 2a17b5a

Browse files
authored
Revert "feat: GA4 이벤트 트래킹 통합 (#70)" (#71)
This reverts commit 0c1b9fa.
1 parent 92bf05e commit 2a17b5a

File tree

18 files changed

+29
-360
lines changed

18 files changed

+29
-360
lines changed

app/gathering/[accessKey]/opinion/complete/CompleteViewContainer.tsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
"use client";
22

3-
import { useEffect } from "react";
4-
import { useParams, redirect } from "next/navigation";
5-
6-
import { trackCtaClick, trackViewPage } from "#/components/analytics";
73
import { Button } from "#/components/button";
84
import { Layout } from "#/components/layout";
95
import {
106
CompleteView,
117
SubmissionBottomSheet,
128
} from "#/pageComponents/gathering/opinion";
9+
import { useParams, redirect } from "next/navigation";
1310
import { useGetGatheringCapacity } from "#/hooks/apis/gathering";
1411
import { Toaster } from "#/components/toast";
1512

16-
const PAGE_ID = "의견수합_완료";
17-
1813
export function CompleteViewContainer() {
1914
const { accessKey } = useParams<{ accessKey: string }>();
2015
const { data: capacity } = useGetGatheringCapacity(accessKey);
@@ -26,21 +21,9 @@ export function CompleteViewContainer() {
2621
}
2722

2823
const handleRedirectResult = () => {
29-
trackCtaClick({ page_id: PAGE_ID, button_name: "추천 결과 보기" });
3024
redirect(`/gathering/${accessKey}/opinion/result`);
3125
};
3226

33-
useEffect(() => {
34-
if (!isPending && capacity) {
35-
trackViewPage({
36-
page_id: PAGE_ID,
37-
submit_progress: Math.round(
38-
(capacity.currentCount / capacity.maxCount) * 100,
39-
),
40-
});
41-
}
42-
}, [capacity, isPending]);
43-
4427
return (
4528
<Layout.Root>
4629
<CompleteView />

app/gathering/[accessKey]/opinion/pending/PendingViewContainer.tsx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
"use client";
22

3-
import { useEffect } from "react";
4-
import { useParams, redirect } from "next/navigation";
5-
6-
import { trackViewPage, trackShareClick } from "#/components/analytics";
73
import { Button } from "#/components/button";
84
import { Layout } from "#/components/layout";
95
import {
106
PendingView,
117
SubmissionBottomSheet,
128
} from "#/pageComponents/gathering/opinion";
9+
import { useParams, redirect } from "next/navigation";
1310
import { useGetGatheringCapacity } from "#/hooks/apis/gathering";
1411
import { share } from "#/utils/share";
1512
import { Toaster } from "#/components/toast";
1613

17-
const PAGE_ID = "의견수합_대기";
18-
1914
export function PendingViewContainer() {
2015
const { accessKey } = useParams<{ accessKey: string }>();
2116
const { data: capacity } = useGetGatheringCapacity(accessKey);
@@ -27,29 +22,14 @@ export function PendingViewContainer() {
2722
}
2823

2924
const handleShare = () => {
30-
trackShareClick({ page_id: PAGE_ID, share_location: "Footer" });
31-
32-
const opinionUrl = `${window.location.origin}/gathering/${accessKey}/landing`;
25+
const opinionUrl = `${window.location.origin}/gathering/${accessKey}/opinion`;
3326
share({
3427
title: "함께 갈 맛집, 같이 정해요!",
3528
text: "[요기잇] 다인원을 위한 맛집 서비스",
3629
url: opinionUrl,
3730
});
3831
};
3932

40-
useEffect(() => {
41-
if (!isComplete && capacity) {
42-
const progress = Math.round(
43-
(capacity.currentCount / capacity.maxCount) * 100,
44-
);
45-
46-
trackViewPage({
47-
page_id: PAGE_ID,
48-
submit_progress: progress,
49-
});
50-
}
51-
}, [capacity, isComplete]);
52-
5333
return (
5434
<Layout.Root>
5535
<PendingView />

app/gathering/[accessKey]/opinion/result/ResultViewContainer.tsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
"use client";
22

3-
import { useEffect } from "react";
4-
import { useParams, redirect } from "next/navigation";
5-
6-
import { trackViewPage, trackShareClick } from "#/components/analytics";
73
import { Layout } from "#/components/layout";
84
import { ShareButton } from "#/components/shareButton";
95
import { ResultView } from "#/pageComponents/gathering/opinion";
6+
import { useParams, redirect } from "next/navigation";
107
import { BackwardButton } from "#/components/backwardButton";
118
import { useGetGatheringCapacity } from "#/hooks/apis/gathering";
129
import { useGetRecommendResult } from "#/hooks/apis/recommendResult";
1310
import { Toaster } from "#/components/toast";
1411

15-
const PAGE_ID = "추천_결과";
16-
1712
export function ResultViewContainer() {
1813
const { accessKey } = useParams<{ accessKey: string }>();
1914
const { data: capacity } = useGetGatheringCapacity(accessKey);
@@ -29,19 +24,6 @@ export function ResultViewContainer() {
2924
redirect(`/gathering/${accessKey}/opinion/complete`);
3025
};
3126

32-
const handleShare = () => {
33-
trackShareClick({ page_id: PAGE_ID, share_location: "Footer" });
34-
};
35-
36-
useEffect(() => {
37-
if (isComplete && recommendationResult && accessKey) {
38-
trackViewPage({
39-
page_id: PAGE_ID,
40-
group_id: accessKey,
41-
});
42-
}
43-
}, [isComplete, recommendationResult, accessKey]);
44-
4527
return (
4628
<Layout.Root>
4729
<Layout.Header background="gray">
@@ -52,7 +34,7 @@ export function ResultViewContainer() {
5234

5335
<Layout.Footer background="gray">
5436
<div className="ygi:px-6">
55-
<ShareButton onShare={handleShare} />
37+
<ShareButton />
5638
</div>
5739
</Layout.Footer>
5840

app/gathering/create/complete/[accessKey]/page.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
"use client";
22

33
import { useParams, useRouter } from "next/navigation";
4-
import { useEffect } from "react";
54

65
import { twJoin } from "tailwind-merge";
76

8-
import { trackCtaClick, trackViewPage } from "#/components/analytics";
97
import { Layout } from "#/components/layout";
108
import { Button } from "#/components/button";
119
import { MeetingCompleteIllustration } from "#/components/illustrations";
1210
import { Toaster } from "#/components/toast";
1311
import { HomeIcon } from "#/icons/homeIcon";
1412

15-
const PAGE_ID = "모임생성_완료";
16-
1713
export default function GatheringCreateCompletePage() {
1814
const params = useParams<{ accessKey: string }>();
1915
const router = useRouter();
@@ -23,19 +19,9 @@ export default function GatheringCreateCompletePage() {
2319
};
2420

2521
const handlePreferenceInput = () => {
26-
trackCtaClick({ page_id: PAGE_ID, button_name: "내 취향 입력" });
2722
router.push(`/gathering/${params.accessKey}/opinion`);
2823
};
2924

30-
useEffect(() => {
31-
if (!params.accessKey) return;
32-
33-
trackViewPage({
34-
page_id: PAGE_ID,
35-
group_id: params.accessKey,
36-
});
37-
}, [params.accessKey]);
38-
3925
return (
4026
<Layout.Root>
4127
<Layout.Header>
Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
"use client";
22

3-
import { GoogleAnalytics, GoogleTagManager } from "@next/third-parties/google";
3+
import { GoogleTagManager } from "@next/third-parties/google";
44

55
const GTM_ID = process.env.NEXT_PUBLIC_GTM_ID;
6-
const GA_ID = process.env.NEXT_PUBLIC_GA_ID;
76

87
export const Analytics = () => {
9-
const isDev = process.env.NODE_ENV === "development";
10-
11-
if (!GTM_ID && isDev) {
12-
console.warn(
13-
"Google Tag Manager ID(NEXT_PUBLIC_GTM_ID) is not configured.",
14-
);
15-
}
16-
17-
if (!GA_ID && isDev) {
18-
console.warn(
19-
"Google Analytics ID(NEXT_PUBLIC_GA_ID) is not configured.",
20-
);
8+
if (!GTM_ID) {
9+
if (process.env.NODE_ENV === "development") {
10+
console.warn(
11+
"Google Tag Manager ID(NEXT_PUBLIC_GTM_ID) is not configured.",
12+
);
13+
}
14+
return null;
2115
}
2216

23-
return (
24-
<>
25-
{GTM_ID && <GoogleTagManager gtmId={GTM_ID} />}
26-
{GA_ID && <GoogleAnalytics gaId={GA_ID} debugMode={isDev} />}
27-
</>
28-
);
17+
return <GoogleTagManager gtmId={GTM_ID} />;
2918
};

src/components/analytics/events.ts

Lines changed: 0 additions & 105 deletions
This file was deleted.

src/components/analytics/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
11
export { Analytics } from "./Analytics";
2-
export {
3-
trackEvent,
4-
trackViewPage,
5-
trackCtaClick,
6-
trackStepComplete,
7-
trackShareClick,
8-
trackRestaurantClick,
9-
} from "./events";

src/components/shareButton/ShareButton.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,12 @@ import { Button, type ButtonProps } from "#/components/button";
44
import { share } from "#/utils/share";
55
import { useParams } from "next/navigation";
66

7-
export type ShareButtonProps = Omit<ButtonProps, "onClick"> & {
8-
onShare?: () => void;
9-
};
7+
export type ShareButtonProps = Omit<ButtonProps, "onClick">;
108

11-
export const ShareButton = ({
12-
disabled,
13-
onShare,
14-
...props
15-
}: ShareButtonProps) => {
9+
export const ShareButton = ({ disabled, ...props }: ShareButtonProps) => {
1610
const { accessKey } = useParams<{ accessKey: string }>();
1711

1812
const handleShare = async () => {
19-
onShare?.();
2013
const url = `${window.location.origin}/gathering/${accessKey}/opinion/result`;
2114
await share({
2215
title: "요기잇 맛집 추천 결과",

0 commit comments

Comments
 (0)