Refactor
This commit is contained in:
@@ -198,6 +198,7 @@ export const accountPageQueryRouter = router({
|
||||
channel: TrackingChannelEnum["scandic-friends"],
|
||||
pageType: `member${parsedtitle}page`,
|
||||
pageName: validatedAccountPage.data.trackingProps.url,
|
||||
siteSections: validatedAccountPage.data.trackingProps.url,
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -129,6 +129,7 @@ export const contentPageQueryRouter = router({
|
||||
channel: TrackingChannelEnum["static-content-page"],
|
||||
pageType: "staticcontentpage",
|
||||
pageName: contentPage.data.trackingProps.url,
|
||||
siteSections: contentPage.data.trackingProps.url,
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -182,6 +182,7 @@ export const loyaltyPageQueryRouter = router({
|
||||
channel: TrackingChannelEnum["scandic-friends"],
|
||||
pageType: "loyaltycontentpage",
|
||||
pageName: validatedLoyaltyPage.data.trackingProps.url,
|
||||
siteSections: validatedLoyaltyPage.data.trackingProps.url,
|
||||
}
|
||||
getLoyaltyPageSuccessCounter.add(1, metricsVariables)
|
||||
console.info(
|
||||
|
||||
@@ -18,9 +18,9 @@ export type TrackingSDKPageData = {
|
||||
pageType: string
|
||||
channel: TrackingChannel
|
||||
siteVersion?: "new-web"
|
||||
pageName: string | null
|
||||
pageName: string
|
||||
domain?: string
|
||||
siteSections?: string
|
||||
siteSections: string
|
||||
pageLoadTime?: number // Page load time in seconds
|
||||
}
|
||||
|
||||
|
||||
@@ -36,16 +36,22 @@ export function trackLoginClick(position: TrackingPosition) {
|
||||
export function createSDKPageObject(
|
||||
trackingData: TrackingSDKData
|
||||
): TrackingSDKData {
|
||||
let pageName = trackingData.pageName?.split("/").slice(1).join("|") ?? ""
|
||||
let pageName = convertSlashToPipe(trackingData.pageName)
|
||||
let siteSections = convertSlashToPipe(trackingData.siteSections)
|
||||
|
||||
if (trackingData.pathName.indexOf("/webview/") > -1) {
|
||||
pageName = "webview|" + pageName
|
||||
siteSections = "webview|" + siteSections
|
||||
}
|
||||
|
||||
return {
|
||||
...trackingData,
|
||||
domain: window.location.host,
|
||||
pageName: pageName,
|
||||
siteSections: trackingData.siteSections ?? pageName,
|
||||
siteSections: siteSections,
|
||||
}
|
||||
}
|
||||
|
||||
function convertSlashToPipe(url: string) {
|
||||
return url?.split("/").slice(1).join("|") ?? ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user