Tracking WIP

This commit is contained in:
Linus Flood
2024-09-27 08:46:12 +02:00
parent 27159d739f
commit 54f094af86
19 changed files with 199 additions and 74 deletions
@@ -178,6 +178,9 @@ export const loyaltyPageSchema = z.object({
updated_at: z.string(),
})
),
page_settings: z.object({
tracking_page_name: z.string().nullable(),
}),
})
.transform((data) => {
return {
@@ -187,6 +190,7 @@ export const loyaltyPageSchema = z.object({
preamble: data.preamble,
sidebar: data.sidebar ? data.sidebar : [],
system: data.system,
pageSettings: data.page_settings,
}
}),
})
@@ -176,11 +176,13 @@ export const loyaltyPageQueryRouter = router({
const loyaltyTrackingData: TrackingSDKPageData = {
pageId: loyaltyPage.system.uid,
lang: loyaltyPage.system.locale as Lang,
domainLanguage: loyaltyPage.system.locale as Lang,
publishedDate: loyaltyPage.system.updated_at,
createdDate: loyaltyPage.system.created_at,
channel: TrackingChannelEnum["scandic-friends"],
pageType: "loyaltycontentpage",
pageName: loyaltyPage.pageSettings.tracking_page_name,
siteSections: loyaltyPage.pageSettings.tracking_page_name, // Always the same as pageName for this page
}
getLoyaltyPageSuccessCounter.add(1, metricsVariables)
console.info(