diff --git a/app/[lang]/(live)/(public)/hotelreservation/select-hotel/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/select-hotel/page.tsx index b6548122c..836964d1e 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/select-hotel/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/select-hotel/page.tsx @@ -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 (
@@ -58,6 +81,7 @@ export default async function SelectHotelPage({
+
) } diff --git a/components/TrackingSDK/RouterTransition.tsx b/components/TrackingSDK/RouterTransition.tsx index b22db682d..d892362b7 100644 --- a/components/TrackingSDK/RouterTransition.tsx +++ b/components/TrackingSDK/RouterTransition.tsx @@ -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, diff --git a/types/components/tracking.ts b/types/components/tracking.ts index 0cd0e843b..822f395e1 100644 --- a/types/components/tracking.ts +++ b/types/components/tracking.ts @@ -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 diff --git a/utils/tracking.ts b/utils/tracking.ts index 793639c13..54cdabe52 100644 --- a/utils/tracking.ts +++ b/utils/tracking.ts @@ -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? } }