Skip to content

Commit 8f31c24

Browse files
youngminssclaude
andcommitted
refactor: 추천 결과 페이지 GA 이벤트 파라미터 개선
- rank를 rank_type(top/other)으로 변경 - onBeforeShare를 onShare로 네이밍 개선 - agreement_rate 파라미터 제거 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f68e4a6 commit 8f31c24

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ export function ResultViewContainer() {
3434
};
3535

3636
useEffect(() => {
37-
if (isComplete && recommendationResult) {
37+
if (isComplete && recommendationResult && accessKey) {
3838
trackPageView("view_page", {
3939
page_id: PAGE_ID,
4040
group_id: accessKey,
41-
agreement_rate: Math.round(recommendationResult.agreementRate),
4241
});
4342
}
4443
}, [isComplete, recommendationResult, accessKey]);
@@ -53,7 +52,7 @@ export function ResultViewContainer() {
5352

5453
<Layout.Footer background="gray">
5554
<div className="ygi:px-6">
56-
<ShareButton onBeforeShare={handleShare} />
55+
<ShareButton onShare={handleShare} />
5756
</div>
5857
</Layout.Footer>
5958

src/components/analytics/events.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ export const trackShareClick = (params: {
9595
* 맛집 클릭 이벤트
9696
*
9797
* @example
98-
* trackRestaurantClick({ page_id: "추천_결과", restaurant_name: "맛집이름", rank: 1 });
98+
* trackRestaurantClick({ page_id: "추천_결과", restaurant_name: "맛집이름", rank_type: "top" });
9999
*/
100100
export const trackRestaurantClick = (params: {
101101
page_id: string;
102102
restaurant_name: string;
103-
rank: number;
103+
rank_type: "top" | "other";
104104
}) => {
105105
trackEvent("click_restaurant", params);
106106
};

src/components/shareButton/ShareButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ import { share } from "#/utils/share";
55
import { useParams } from "next/navigation";
66

77
export type ShareButtonProps = Omit<ButtonProps, "onClick"> & {
8-
onBeforeShare?: () => void;
8+
onShare?: () => void;
99
};
1010

1111
export const ShareButton = ({
1212
disabled,
13-
onBeforeShare,
13+
onShare,
1414
...props
1515
}: ShareButtonProps) => {
1616
const { accessKey } = useParams<{ accessKey: string }>();
1717

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

src/pageComponents/gathering/restaurantCard/OtherCandidateCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const OtherCandidateCard = ({
2424
trackRestaurantClick({
2525
page_id: "추천_결과",
2626
restaurant_name: restaurant.restaurantName,
27-
rank: ranking,
27+
rank_type: "other",
2828
});
2929
window.open(restaurant.mapUrl, "_blank", "noopener,noreferrer");
3030
};

src/pageComponents/gathering/restaurantCard/TopRecommendCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const TopRecommendCard = ({ restaurant }: TopRecommendCardProps) => {
2727
trackRestaurantClick({
2828
page_id: "추천_결과",
2929
restaurant_name: restaurant.restaurantName,
30-
rank: 1,
30+
rank_type: "top",
3131
});
3232
window.open(restaurant.mapUrl, "_blank", "noopener,noreferrer");
3333
};

0 commit comments

Comments
 (0)