refactor(LOY-48): add signup specific content page tracking
This commit is contained in:
committed by
Chuma Mcphoy (We Ahead)
parent
a6f14e09cf
commit
ea27bb01e2
@@ -4,7 +4,6 @@ import "@scandic-hotels/design-system/style.css"
|
||||
import Script from "next/script"
|
||||
|
||||
import TokenRefresher from "@/components/Auth/TokenRefresher"
|
||||
import BookingWidget from "@/components/BookingWidget"
|
||||
import CookieBotConsent from "@/components/CookieBot"
|
||||
import AdobeScript from "@/components/Current/AdobeScript"
|
||||
import Footer from "@/components/Current/Footer"
|
||||
|
||||
@@ -8,15 +8,14 @@ import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import { contentPageSchema } from "./output"
|
||||
import {
|
||||
createChannel,
|
||||
createPageType,
|
||||
fetchContentPageRefs,
|
||||
generatePageTags,
|
||||
getContentPageCounter,
|
||||
} from "./utils"
|
||||
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
type TrackingSDKPageData,
|
||||
} from "@/types/components/tracking"
|
||||
import type { TrackingSDKPageData } from "@/types/components/tracking"
|
||||
import type { GetContentPageSchema } from "@/types/trpc/routers/contentstack/contentPage"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
@@ -89,8 +88,8 @@ export const contentPageQueryRouter = router({
|
||||
domainLanguage: contentPage.data.content_page.system.locale as Lang,
|
||||
publishedDate: contentPage.data.content_page.system.updated_at,
|
||||
createdDate: contentPage.data.content_page.system.created_at,
|
||||
channel: TrackingChannelEnum["static-content-page"],
|
||||
pageType: "staticcontentpage",
|
||||
channel: createChannel(contentPage.data.content_page.system.uid),
|
||||
pageType: createPageType(contentPage.data.content_page.system.uid),
|
||||
pageName: contentPage.data.trackingProps.url,
|
||||
siteSections: contentPage.data.trackingProps.url,
|
||||
siteVersion: "new-web",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { metrics } from "@opentelemetry/api"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { batchRequest } from "@/lib/graphql/batchRequest"
|
||||
import {
|
||||
GetContentPageBlocksRefs,
|
||||
@@ -12,12 +11,14 @@ import { generateTag, generateTagsFromSystem } from "@/utils/generateTag"
|
||||
|
||||
import { contentPageRefsSchema } from "./output"
|
||||
|
||||
import { TrackingChannelEnum } from "@/types/components/tracking"
|
||||
import { ContentPageEnum } from "@/types/enums/contentPage"
|
||||
import { System } from "@/types/requests/system"
|
||||
import {
|
||||
import type { System } from "@/types/requests/system"
|
||||
import type {
|
||||
ContentPageRefs,
|
||||
GetContentPageRefsSchema,
|
||||
} from "@/types/trpc/routers/contentstack/contentPage"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
const meter = metrics.getMeter("trpc.contentPage")
|
||||
// OpenTelemetry metrics: ContentPage
|
||||
@@ -224,3 +225,27 @@ export function getConnections({ content_page }: ContentPageRefs) {
|
||||
}
|
||||
return connections
|
||||
}
|
||||
|
||||
const signupContentPageUid = "blt0e6bd6c4d7224f07"
|
||||
const signupVerifyContentPageUid = "blt3247a2a29b34a8e8"
|
||||
|
||||
export function createPageType(uid: string): string {
|
||||
switch (uid) {
|
||||
case signupContentPageUid:
|
||||
return "memberprofilecreatepage"
|
||||
case signupVerifyContentPageUid:
|
||||
return "memberprofilecreatesuccesspage"
|
||||
default:
|
||||
return "staticcontentpage"
|
||||
}
|
||||
}
|
||||
|
||||
export function createChannel(uid: string): TrackingChannelEnum {
|
||||
switch (uid) {
|
||||
case signupContentPageUid:
|
||||
case signupVerifyContentPageUid:
|
||||
return TrackingChannelEnum["scandic-friends"]
|
||||
default:
|
||||
return TrackingChannelEnum["static-content-page"]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user