Merged in fix/SW-2676-tracking-select-hotel (pull request #2165)

Fix/SW-2676 tracking select hotel

* fix(SW-2676): add tracking select hotel

* fix(SW-2676): fix tracking text

* fix(SW-2676): create tracking function


Approved-by: Tobias Johansson
This commit is contained in:
Bianca Widstam
2025-05-22 11:44:47 +00:00
parent cc34cdcf74
commit 3e0190d5e7
4 changed files with 58 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ import { useCallback } from "react"
import { useHotelsMapStore } from "@/stores/hotels-map"
import HotelCardDialog from "@/components/HotelReservation/HotelCardDialog"
import { trackEvent } from "@/utils/tracking/base"
import HotelPin from "./HotelPin"
@@ -19,12 +20,20 @@ function HotelListingMapContent({ hotelPins }: HotelListingMapContentProps) {
useHotelsMapStore()
const toggleActiveHotelPin = useCallback(
(pinName: string | null) => {
(pinName: string | null, hotelId: string) => {
if (activeHotel === pinName || pinName === null) {
deactivate()
return
}
trackEvent({
event: "hotelClickMap",
map: {
action: "hotel click - map",
},
hotelInfo: {
hotelId,
},
})
activate(pinName)
},
[activeHotel, activate, deactivate]
@@ -58,7 +67,7 @@ function HotelListingMapContent({ hotelPins }: HotelListingMapContentProps) {
zIndex={isActiveOrHovered ? 2 : 0}
onMouseEnter={() => engage(pin.name)}
onMouseLeave={() => disengage()}
onClick={() => toggleActiveHotelPin(pin.name)}
onClick={() => toggleActiveHotelPin(pin.name, pin.operaId)}
>
<div className={styles.dialogContainer}>
<HotelCardDialog