Merged in feat/enter-details-tracking (pull request #1185)
Feat/enter details tracking * feat: fixed bug in enter details tracking * Sidepeek events, lowestroomPrice and analyticsRateCode * Cleanup and fixed bug * Fixed analyticsratecode * Merge master * merge master * Removed console logs * Added ancillaries tracking to enter details * Added ancillary on confirmation page * Removed console log * Merge branch 'master' into feat/enter-details-tracking * Refactor searchparams * Hard code values for breakfast ancillary Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import type { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek"
|
||||
import type {
|
||||
LowestRoomPriceEvent,
|
||||
PaymentEvent,
|
||||
PaymentFailEvent,
|
||||
TrackingPosition,
|
||||
@@ -100,6 +102,26 @@ export function trackUpdatePaymentMethod(hotelId: string, method: string) {
|
||||
pushToDataLayer(paymentSelectionEvent)
|
||||
}
|
||||
|
||||
export function trackOpenSidePeekEvent(
|
||||
sidePeek: SidePeekEnum | null,
|
||||
hotelId: string,
|
||||
pathName: string,
|
||||
roomTypeCode?: string | null
|
||||
) {
|
||||
const openSidePeekEvent = {
|
||||
event: "openSidePeek",
|
||||
hotelInfo: {
|
||||
hotelId: hotelId,
|
||||
},
|
||||
cta: {
|
||||
name: sidePeek,
|
||||
roomTypeCode,
|
||||
pathName,
|
||||
},
|
||||
}
|
||||
pushToDataLayer(openSidePeekEvent)
|
||||
}
|
||||
|
||||
export function trackPaymentEvent(paymentEvent: PaymentEvent) {
|
||||
const paymentAttempt = {
|
||||
event: paymentEvent.event,
|
||||
@@ -119,6 +141,22 @@ export function trackPaymentEvent(paymentEvent: PaymentEvent) {
|
||||
pushToDataLayer(paymentAttempt)
|
||||
}
|
||||
|
||||
export function trackLowestRoomPrice(event: LowestRoomPriceEvent) {
|
||||
const lowestRoomPrice = {
|
||||
event: "lowestRoomPrice",
|
||||
hotelInfo: {
|
||||
hotelId: event.hotelId,
|
||||
arrivalDate: event.arrivalDate,
|
||||
departureDate: event.departureDate,
|
||||
},
|
||||
price: {
|
||||
lowestPrice: event.lowestPrice,
|
||||
currency: event.currency,
|
||||
},
|
||||
}
|
||||
pushToDataLayer(lowestRoomPrice)
|
||||
}
|
||||
|
||||
export function pushToDataLayer(data: any) {
|
||||
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
||||
window.adobeDataLayer.push(data)
|
||||
|
||||
Reference in New Issue
Block a user