Some hotelInfo tracking on select-hotel page

This commit is contained in:
Linus Flood
2024-10-18 10:25:45 +02:00
parent 42640abb2b
commit bbf52c8dce
4 changed files with 30 additions and 1 deletions

View File

@@ -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>
)
}

View File

@@ -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,

View File

@@ -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

View File

@@ -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?
}
}