Some hotelInfo tracking on select-hotel page
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { selectHotelMap } from "@/constants/routes/hotelReservation"
|
||||
|
||||
import {
|
||||
@@ -9,11 +10,17 @@ import HotelFilter from "@/components/HotelReservation/SelectHotel/HotelFilter"
|
||||
import { ChevronRightIcon } from "@/components/Icons"
|
||||
import StaticMap from "@/components/Maps/StaticMap"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
TrackingSDKHotelInfo,
|
||||
TrackingSDKPageData,
|
||||
} from "@/types/components/tracking"
|
||||
import { LangParams, PageArgs } from "@/types/params"
|
||||
|
||||
export default async function SelectHotelPage({
|
||||
@@ -33,6 +40,22 @@ export default async function SelectHotelPage({
|
||||
|
||||
const filterList = getFiltersFromHotels(hotels)
|
||||
|
||||
const pageTrackingData: TrackingSDKPageData = {
|
||||
pageId: "select-hotel",
|
||||
domainLanguage: params.lang as Lang,
|
||||
channel: TrackingChannelEnum["hotelreservation"],
|
||||
pageName: "hotelreservation|select-hotel",
|
||||
siteSections: "hotelreservation|select-hotel",
|
||||
createdDate: "",
|
||||
publishedDate: "",
|
||||
pageType: "selecthotelpage",
|
||||
}
|
||||
|
||||
const hotelsTrackingData: TrackingSDKHotelInfo = {
|
||||
availableResults: hotels.length,
|
||||
searchTerm: tempSearchTerm,
|
||||
}
|
||||
|
||||
return (
|
||||
<main className={styles.main}>
|
||||
<section className={styles.section}>
|
||||
@@ -58,6 +81,7 @@ export default async function SelectHotelPage({
|
||||
<HotelFilter filters={filterList} />
|
||||
</section>
|
||||
<HotelCardListing hotelData={hotels} />
|
||||
<TrackingSDK pageData={pageTrackingData} hotelInfo={hotelsTrackingData} />
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ export default function RouterTransition({
|
||||
}
|
||||
const pageObject = createSDKPageObject(trackingData)
|
||||
console.log("TRACKING: Tracking initial pageView", pageObject)
|
||||
console.log("TRACKING: Tracking initial userData", userData)
|
||||
console.log("TRACKING: Tracking initial hotelInfo", hotelInfo)
|
||||
window.adobeDataLayer.push({
|
||||
event: "pageView",
|
||||
pageInfo: pageObject,
|
||||
@@ -100,6 +102,8 @@ export default function RouterTransition({
|
||||
"TRACKING: Tracking RouterTransition pageViewEnd",
|
||||
pageObject
|
||||
)
|
||||
console.log("TRACKING: Tracking RouterTransition userData", userData)
|
||||
console.log("TRACKING: Tracking RouterTransition hotelInfo", hotelInfo)
|
||||
window.adobeDataLayer.push({
|
||||
event: "pageViewEnd",
|
||||
pageInfo: pageObject,
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { Lang } from "@/constants/languages"
|
||||
export enum TrackingChannelEnum {
|
||||
"scandic-friends" = "scandic-friends",
|
||||
"static-content-page" = "static-content-page",
|
||||
"hotelreservation" = "hotelreservation",
|
||||
}
|
||||
|
||||
export type TrackingChannel = keyof typeof TrackingChannelEnum
|
||||
|
||||
@@ -49,6 +49,6 @@ export function createSDKPageObject(
|
||||
...trackingData,
|
||||
domain: window.location.host,
|
||||
pageName: pageName,
|
||||
siteSections: pageName, // TODO: We need to support other siteSections values in some cases.
|
||||
siteSections: pageName, //TODO: Always seems to be the same as pageName?
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user