Merged in feat/SW-1472-destination-tracking (pull request #1474)
Feat/SW-1472 destination tracking * feat(SW-1472): Added default tracking for destination overview page * feat(SW-1472): Added default tracking for destination country/city page * feat(SW-1472): moved tracking functions to different files for better overview * feat(SW-1472): added destination page tracking Approved-by: Fredrik Thorsson Approved-by: Matilda Landström
This commit is contained in:
@@ -23,6 +23,10 @@ import {
|
||||
} from "./telemetry"
|
||||
import { generatePageTags } from "./utils"
|
||||
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
type TrackingSDKPageData,
|
||||
} from "@/types/components/tracking"
|
||||
import type {
|
||||
GetDestinationCityPageData,
|
||||
GetDestinationCityPageRefsSchema,
|
||||
@@ -147,8 +151,8 @@ export const destinationCityPageQueryRouter = router({
|
||||
)
|
||||
return null
|
||||
}
|
||||
const cityIdentifier =
|
||||
validatedResponse.data.destinationCityPage.destination_settings.city
|
||||
const destinationCityPage = validatedResponse.data.destination_city_page
|
||||
const cityIdentifier = destinationCityPage.destination_settings.city
|
||||
const city = await getCityByCityIdentifier(cityIdentifier, serviceToken)
|
||||
|
||||
if (!city) {
|
||||
@@ -177,10 +181,26 @@ export const destinationCityPageQueryRouter = router({
|
||||
})
|
||||
)
|
||||
|
||||
const system = destinationCityPage.system
|
||||
const pageName = `hotels|${city.country ? `${city.country}|` : ""}${city.name}`
|
||||
|
||||
const tracking: TrackingSDKPageData = {
|
||||
pageId: system.uid,
|
||||
domainLanguage: system.locale,
|
||||
publishDate: system.updated_at,
|
||||
createDate: system.created_at,
|
||||
channel: TrackingChannelEnum.hotels,
|
||||
pageType: "citypage",
|
||||
pageName,
|
||||
siteSections: pageName,
|
||||
siteVersion: "new-web",
|
||||
}
|
||||
|
||||
return {
|
||||
...validatedResponse.data,
|
||||
destinationCityPage,
|
||||
cityIdentifier,
|
||||
city,
|
||||
tracking,
|
||||
}
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user