Skip to content

Commit 5755eb6

Browse files
committed
feat : 7. 장소리스트 중 하나의 장소 탐색
1 parent 6f868bc commit 5755eb6

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

app/recommend/page.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Image from 'next/image';
66
import KakaoMapRecommend from '@/components/map/kakaoMapRecommend';
77
import { useRecommend } from '@/hooks/api/query/useRecommend';
88
import { useCheckMeeting } from '@/hooks/api/query/useCheckMeeting';
9+
import { sendGAEvent } from '@next/third-parties/google';
910

1011
function RecommendContent() {
1112
const router = useRouter();
@@ -148,6 +149,20 @@ function RecommendContent() {
148149
}
149150
};
150151

152+
// 장소 리스트 중 하나 클릭 시 GA 전송 (place_list_viewed)
153+
const handlePlaceClick = (place: (typeof places)[0]) => {
154+
setSelectedPlaceId(place.id);
155+
if (meetingId) {
156+
const candidateId = `place_${String(place.id).padStart(2, '0')}`;
157+
sendGAEvent('event', 'place_list_viewed', {
158+
meeting_url_id: meetingId,
159+
candidate_id: candidateId,
160+
place_category: place.category,
161+
rank_order: place.id,
162+
});
163+
}
164+
};
165+
151166
return (
152167
<div className="flex items-center justify-center p-0 md:min-h-[calc(100vh-200px)] md:py-25">
153168
<div className="flex h-full w-full flex-col bg-white md:h-175 md:w-174 md:flex-row md:gap-2 lg:w-215">
@@ -194,7 +209,7 @@ function RecommendContent() {
194209
{places.map((place) => (
195210
<div
196211
key={place.id}
197-
onClick={() => setSelectedPlaceId(place.id)}
212+
onClick={() => handlePlaceClick(place)}
198213
className={`flex cursor-pointer flex-col gap-2 rounded border p-4 ${
199214
selectedPlaceId === place.id
200215
? 'border-blue-5 border-2'

0 commit comments

Comments
 (0)