Feat/SW-1472 destination tracking * feat(SW-1472): Added default tracking for destination overview page * feat(SW-1472): Added default tracking for destination country/city page * feat(SW-1472): moved tracking functions to different files for better overview * feat(SW-1472): added destination page tracking Approved-by: Fredrik Thorsson Approved-by: Matilda Landström
20 lines
390 B
TypeScript
20 lines
390 B
TypeScript
export function trackEvent(data: any) {
|
|
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
|
data = { ...data, siteVersion: "new-web" }
|
|
window.adobeDataLayer.push(data)
|
|
}
|
|
}
|
|
|
|
export function trackClick(
|
|
name: string,
|
|
additionalParams?: Record<string, string>
|
|
) {
|
|
trackEvent({
|
|
event: "linkClick",
|
|
cta: {
|
|
...additionalParams,
|
|
name,
|
|
},
|
|
})
|
|
}
|