From 77eff2b49c9b5a21b5cf9d9746561713095e5b41 Mon Sep 17 00:00:00 2001 From: Bianca Widstam Date: Thu, 24 Apr 2025 13:41:29 +0000 Subject: [PATCH] Merged in fix/SW-1997-gla-tracking (pull request #1852) fix(SW-1997): add price and currency * fix(SW-1997): add price and currency * fix(SW-1997): wrap lateArrivalGuaranteee and guaranteedProduct in hotelInfo Approved-by: Niclas Edenvin --- .../GuaranteeLateArrivalCallback/index.tsx | 12 ++++++-- apps/scandic-web/utils/tracking/myStay.ts | 30 ++++++++++++------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/apps/scandic-web/components/HotelReservation/MyStay/GuaranteeLateArrival/GuaranteeLateArrivalCallback/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/GuaranteeLateArrival/GuaranteeLateArrivalCallback/index.tsx index e5f7ecff0..349699b5f 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/GuaranteeLateArrival/GuaranteeLateArrivalCallback/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/GuaranteeLateArrival/GuaranteeLateArrivalCallback/index.tsx @@ -48,19 +48,25 @@ export default function TrackGuarantee({ productUnits: pkg.quantity, productPoints: selectedAncillary?.points, productDeliveryTime: formData?.deliveryTime, - productPrice: selectedAncillary?.price, + productPrice: selectedAncillary?.price.total, + currency: selectedAncillary?.price.currency, productName: selectedAncillary?.title, productCategory: selectedAncillary?.categoryName, })), - lateArrivalGuarantee: "yes", - guaranteedProduct: "room + ancillary", + hotelInfo: { + hotelId: selectedAncillary?.hotelId, + lateArrivalGuarantee: "yes", + guaranteedProduct: "room + ancillary", + }, }) } const trackGuaranteePaymentEvent = (event: string, status: string) => { + const glaHotelInfo = readGlaFromSessionStorage() trackEvent({ event, hotelInfo: { + hotelId: glaHotelInfo?.hotelId, lateArrivalGuarantee: "yes", guaranteedProduct: "room", }, diff --git a/apps/scandic-web/utils/tracking/myStay.ts b/apps/scandic-web/utils/tracking/myStay.ts index 873e2748c..e2f8b02b0 100644 --- a/apps/scandic-web/utils/tracking/myStay.ts +++ b/apps/scandic-web/utils/tracking/myStay.ts @@ -66,12 +66,16 @@ export function trackGlaAncillaryAttempt( productUnits: pkg.quantity, productPoints: selectedAncillary?.points, productDeliveryTime: deliveryTime, - productPrice: selectedAncillary?.price, + productPrice: selectedAncillary?.price.total, + currency: selectedAncillary?.price.currency, productName: selectedAncillary?.title, productCategory: selectedAncillary?.categoryName, })), - lateArrivalGuarantee: "yes", - guaranteedProduct: "room + ancillary", + hotelInfo: { + hotelId: selectedAncillary?.hotelId, + lateArrivalGuarantee: "yes", + guaranteedProduct: "room + ancillary", + }, }) } @@ -93,6 +97,8 @@ export function trackAncillarySuccess( hotelInfo: { bnr: confirmationNumber, roomTypeCode: roomTypeCode, + lateArrivalGuarantee: "yes", + guaranteedProduct: guaranteedProduct, }, paymentInfo: { status: "glacardsaveconfirmed", @@ -103,12 +109,11 @@ export function trackAncillarySuccess( productUnits: pkg.quantity, productPoints: selectedAncillary?.points, productDeliveryTime: deliveryTime, - productPrice: selectedAncillary?.price, + productPrice: selectedAncillary?.price.total, + currency: selectedAncillary?.price.currency, productName: selectedAncillary?.title, productCategory: selectedAncillary?.categoryName, })), - lateArrivalGuarantee: "yes", - guaranteedProduct: guaranteedProduct, }) } @@ -128,12 +133,16 @@ export function trackAncillaryFailed( productUnits: pkg.quantity, productPoints: selectedAncillary?.points, productDeliveryTime: deliveryTime, - productPrice: selectedAncillary?.price, + productPrice: selectedAncillary?.price.total, + currency: selectedAncillary?.price.currency, productName: selectedAncillary?.title, productCategory: selectedAncillary?.categoryName, })), - lateArrivalGuarantee: "yes", - guaranteedProduct: "ancillary", + hotelInfo: { + hotelId: selectedAncillary?.hotelId, + lateArrivalGuarantee: "yes", + guaranteedProduct: "ancillary", + }, }) } @@ -184,7 +193,8 @@ export function trackAddAncillary( productId: ancillary?.id, productName: ancillary?.title, productUnits: quantityWithCard, - productPrice: ancillary?.price, + productPrice: ancillary?.price.total, + currency: ancillary?.price.currency, productCategory: ancillary?.categoryName, }) }