feat(SW-1472): adjustments to destination page tracking
Approved-by: Matilda Landström
This commit is contained in:
@@ -17,12 +17,17 @@ export default function DestinationTracking({
|
|||||||
}: DestinationTrackingProps) {
|
}: DestinationTrackingProps) {
|
||||||
const searchParams = useSearchParams()
|
const searchParams = useSearchParams()
|
||||||
const isMapView = searchParams.get("view") === "map"
|
const isMapView = searchParams.get("view") === "map"
|
||||||
|
const pagetype =
|
||||||
|
pageData.pageType === "countrypage"
|
||||||
|
? "countrymapviewpage"
|
||||||
|
: "citymapviewpage"
|
||||||
|
const pagename = `${pageData.pageName}|map-view`
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isMapView) {
|
if (isMapView) {
|
||||||
trackOpenMapView(pageData.pageName, pageData.pageType)
|
trackOpenMapView(pagename, pagetype)
|
||||||
}
|
}
|
||||||
}, [isMapView, pageData.pageName, pageData.pageType])
|
}, [isMapView, pagename, pagetype])
|
||||||
|
|
||||||
return <TrackingSDK pageData={pageData} />
|
return <TrackingSDK pageData={pageData} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ export const destinationCityPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const system = destinationCityPage.system
|
const system = destinationCityPage.system
|
||||||
const pageName = `hotels|${city.country ? `${city.country}|` : ""}${city.name}`
|
const pageName = `destinations|${city.country}|${city.name}`
|
||||||
|
|
||||||
const tracking: TrackingSDKPageData = {
|
const tracking: TrackingSDKPageData = {
|
||||||
pageId: system.uid,
|
pageId: system.uid,
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ export const destinationCountryPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const system = destinationCountryPage.system
|
const system = destinationCountryPage.system
|
||||||
const pageName = `hotels|${country}`
|
const pageName = `destinations|${country}`
|
||||||
|
|
||||||
const tracking: TrackingSDKPageData = {
|
const tracking: TrackingSDKPageData = {
|
||||||
pageId: system.uid,
|
pageId: system.uid,
|
||||||
|
|||||||
@@ -188,8 +188,8 @@ export const destinationOverviewPageQueryRouter = router({
|
|||||||
createDate: system.created_at,
|
createDate: system.created_at,
|
||||||
channel: TrackingChannelEnum.hotels,
|
channel: TrackingChannelEnum.hotels,
|
||||||
pageType: "destinationoverviewpage",
|
pageType: "destinationoverviewpage",
|
||||||
pageName: "destination|overview",
|
pageName: "destinations|overview",
|
||||||
siteSections: "destination|overview",
|
siteSections: "destinations|overview",
|
||||||
siteVersion: "new-web",
|
siteVersion: "new-web",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ export function trackMapClick(name: string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function trackOpenMapView(pageName: string, pageType: string) {
|
export function trackOpenMapView(pagename: string, pagetype: string) {
|
||||||
trackEvent({
|
trackEvent({
|
||||||
event: "openMapView",
|
event: "openMapView",
|
||||||
map: {
|
map: {
|
||||||
pageName,
|
pagename,
|
||||||
pageType,
|
pagetype,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user