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 Script from "next/script"
|
||||||
|
|
||||||
import TokenRefresher from "@/components/Auth/TokenRefresher"
|
import TokenRefresher from "@/components/Auth/TokenRefresher"
|
||||||
import BookingWidget from "@/components/BookingWidget"
|
|
||||||
import CookieBotConsent from "@/components/CookieBot"
|
import CookieBotConsent from "@/components/CookieBot"
|
||||||
import AdobeScript from "@/components/Current/AdobeScript"
|
import AdobeScript from "@/components/Current/AdobeScript"
|
||||||
import Footer from "@/components/Current/Footer"
|
import Footer from "@/components/Current/Footer"
|
||||||
|
|||||||
@@ -8,15 +8,14 @@ import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
|||||||
|
|
||||||
import { contentPageSchema } from "./output"
|
import { contentPageSchema } from "./output"
|
||||||
import {
|
import {
|
||||||
|
createChannel,
|
||||||
|
createPageType,
|
||||||
fetchContentPageRefs,
|
fetchContentPageRefs,
|
||||||
generatePageTags,
|
generatePageTags,
|
||||||
getContentPageCounter,
|
getContentPageCounter,
|
||||||
} from "./utils"
|
} from "./utils"
|
||||||
|
|
||||||
import {
|
import type { TrackingSDKPageData } from "@/types/components/tracking"
|
||||||
TrackingChannelEnum,
|
|
||||||
type TrackingSDKPageData,
|
|
||||||
} from "@/types/components/tracking"
|
|
||||||
import type { GetContentPageSchema } from "@/types/trpc/routers/contentstack/contentPage"
|
import type { GetContentPageSchema } from "@/types/trpc/routers/contentstack/contentPage"
|
||||||
import type { Lang } from "@/constants/languages"
|
import type { Lang } from "@/constants/languages"
|
||||||
|
|
||||||
@@ -89,8 +88,8 @@ export const contentPageQueryRouter = router({
|
|||||||
domainLanguage: contentPage.data.content_page.system.locale as Lang,
|
domainLanguage: contentPage.data.content_page.system.locale as Lang,
|
||||||
publishedDate: contentPage.data.content_page.system.updated_at,
|
publishedDate: contentPage.data.content_page.system.updated_at,
|
||||||
createdDate: contentPage.data.content_page.system.created_at,
|
createdDate: contentPage.data.content_page.system.created_at,
|
||||||
channel: TrackingChannelEnum["static-content-page"],
|
channel: createChannel(contentPage.data.content_page.system.uid),
|
||||||
pageType: "staticcontentpage",
|
pageType: createPageType(contentPage.data.content_page.system.uid),
|
||||||
pageName: contentPage.data.trackingProps.url,
|
pageName: contentPage.data.trackingProps.url,
|
||||||
siteSections: contentPage.data.trackingProps.url,
|
siteSections: contentPage.data.trackingProps.url,
|
||||||
siteVersion: "new-web",
|
siteVersion: "new-web",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { metrics } from "@opentelemetry/api"
|
import { metrics } from "@opentelemetry/api"
|
||||||
|
|
||||||
import { Lang } from "@/constants/languages"
|
|
||||||
import { batchRequest } from "@/lib/graphql/batchRequest"
|
import { batchRequest } from "@/lib/graphql/batchRequest"
|
||||||
import {
|
import {
|
||||||
GetContentPageBlocksRefs,
|
GetContentPageBlocksRefs,
|
||||||
@@ -12,12 +11,14 @@ import { generateTag, generateTagsFromSystem } from "@/utils/generateTag"
|
|||||||
|
|
||||||
import { contentPageRefsSchema } from "./output"
|
import { contentPageRefsSchema } from "./output"
|
||||||
|
|
||||||
|
import { TrackingChannelEnum } from "@/types/components/tracking"
|
||||||
import { ContentPageEnum } from "@/types/enums/contentPage"
|
import { ContentPageEnum } from "@/types/enums/contentPage"
|
||||||
import { System } from "@/types/requests/system"
|
import type { System } from "@/types/requests/system"
|
||||||
import {
|
import type {
|
||||||
ContentPageRefs,
|
ContentPageRefs,
|
||||||
GetContentPageRefsSchema,
|
GetContentPageRefsSchema,
|
||||||
} from "@/types/trpc/routers/contentstack/contentPage"
|
} from "@/types/trpc/routers/contentstack/contentPage"
|
||||||
|
import type { Lang } from "@/constants/languages"
|
||||||
|
|
||||||
const meter = metrics.getMeter("trpc.contentPage")
|
const meter = metrics.getMeter("trpc.contentPage")
|
||||||
// OpenTelemetry metrics: ContentPage
|
// OpenTelemetry metrics: ContentPage
|
||||||
@@ -224,3 +225,27 @@ export function getConnections({ content_page }: ContentPageRefs) {
|
|||||||
}
|
}
|
||||||
return connections
|
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