Files
web/apps/scandic-web/utils/tracking/profilingConsent.ts
Matilda Landström b122f2ff4f Merged in feat/LOY-490-cleanup-profiling-consent (pull request #3237)
Feat/LOY-490 cleanup profiling consent

* chore(LOY-490): cleanup accordion

* xhore(LOY-490): cleanup signup

* fix(LOY-490): use correct tokens

* fi(LOY-490): change button to correct color

* fix(LOY-490): switch deprecated Link


Approved-by: Chuma Mcphoy (We Ahead)
2025-11-27 07:48:34 +00:00

64 lines
1.3 KiB
TypeScript

import { trackEvent } from "@scandic-hotels/tracking/base"
import type { TrackingSDKPageData } from "@scandic-hotels/tracking/types"
interface trackLinkClickProps {
position: "modal" | "banner" | "signup" | "profile"
name: string
}
export function trackLinkClick({ position, name }: trackLinkClickProps) {
trackEvent({
event: "profileConsent",
profile: {
position: position,
},
link: {
name: name,
},
})
}
interface trackConsentChangeProps {
to: boolean
from?: boolean
}
export function trackConsentChange({ to, from }: trackConsentChangeProps) {
trackEvent({
event: "profileConsentUpdate",
profile: {
fromConsent: from,
toConsent: to,
},
cta: {
name: "save & update the preferences",
},
})
}
interface trackConsentActionProps {
position: "modal" | "banner" | "profile"
name: string
}
export function trackConsentAction({
position,
name,
}: trackConsentActionProps) {
trackEvent({
event: "profileConsent",
profile: {
position: position,
},
cta: {
name: name,
},
})
}
export const ModalTracking: Omit<TrackingSDKPageData, "domainLanguage"> = {
pageType: "profileconsentmodalpage",
channel: "scandic-friends",
siteVersion: "new-web",
pageName: "profile consent modal",
siteSections: "profile consent modal",
}