Merged in fix/BOOK-459-tracking-search (pull request #2984)

fix(BOOK-459): update searchTerm to city or hotelname

* fix(BOOK-459): update searchTerm to city or hotelname


Approved-by: Erik Tiekstra
This commit is contained in:
Bianca Widstam
2025-10-22 14:34:59 +00:00
parent acdc3dcec1
commit 76c353058b
17 changed files with 40 additions and 35 deletions

View File

@@ -10,6 +10,7 @@ import { useSessionId } from "@scandic-hotels/common/hooks/useSessionId"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { trackNoAvailability } from "@scandic-hotels/tracking/NoAvailabilityTracking"
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
import useLang from "../../../../hooks/useLang"
@@ -169,6 +170,7 @@ export default function BookingAlert({ isVisible = false }: BookingAlertProps) {
function useNoAvailabilityTracking() {
const { fromDate, toDate, hotelId, bookingCode, searchType, rooms } =
useEnterDetailsStore((state) => state.booking)
const hotelName = useEnterDetailsStore((state) => state.hotelName)
const lang = useLang()
const sessionId = useSessionId()
@@ -186,12 +188,13 @@ function useNoAvailabilityTracking() {
trackNoAvailability({
specialRoomType,
lang,
searchTerm: hotelId,
searchTerm: hotelName,
fromDate,
toDate,
hotelId,
noOfRooms: rooms.length,
searchType,
searchType: "hotel",
rewardNight: searchType === SEARCH_TYPE_REDEMPTION ? "yes" : "no",
bookingCode: bookingCode ?? "n/a",
pageId: "details",
pageName: "hotelreservation|details",
@@ -203,9 +206,10 @@ function useNoAvailabilityTracking() {
[
specialRoomType,
lang,
hotelId,
hotelName,
fromDate,
toDate,
hotelId,
rooms.length,
searchType,
bookingCode,

View File

@@ -3,7 +3,6 @@
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
import { useBookingFlowConfig } from "../../../bookingFlowConfig/bookingFlowConfigContext"
import { useSearchHistory } from "../../../hooks/useSearchHistory"
import { useEnterDetailsStore } from "../../../stores/enter-details"
import { getTracking } from "./tracking"
@@ -33,8 +32,6 @@ export default function EnterDetailsTrackingWrapper({
breakfastPackages: state.breakfastPackages,
}))
const config = useBookingFlowConfig()
const searchHistory = useSearchHistory()
const searchTerm = searchHistory.searchHistory[0]?.name
const { hotelsTrackingData, pageTrackingData, ancillaries } = getTracking(
booking,
@@ -44,8 +41,7 @@ export default function EnterDetailsTrackingWrapper({
lang,
storedRooms,
breakfastPackages,
config,
searchTerm
config
)
return (

View File

@@ -36,8 +36,7 @@ export function getTracking(
lang: Lang,
storedRooms: RoomState[],
breakfastPackages: BreakfastPackages,
config: Pick<BookingFlowConfig, "bookingCodeEnabled">,
searchTerm?: string
config: Pick<BookingFlowConfig, "bookingCodeEnabled">
) {
const arrivalDate = new Date(booking.fromDate)
const departureDate = new Date(booking.toDate)
@@ -205,7 +204,7 @@ export function getTracking(
// @ts-expect-error - redemption object doesn't exist error
rooms.find((room) => "redemption" in room.roomRate)?.roomRate.redemption
.localPrice.pointsPerStay ?? "n/a",
searchTerm,
searchTerm: hotel.name,
searchType: "hotel",
specialRoomType: rooms
.map((room) => getSpecialRoomType(room.packages))