Merged in feat/SW-1472-destination-tracking (pull request #1474)
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
This commit is contained in:
59
apps/scandic-web/utils/tracking/destinationPage.ts
Normal file
59
apps/scandic-web/utils/tracking/destinationPage.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { trackEvent } from "./base"
|
||||
|
||||
export function trackSortingChangeEvent(sortOption: string) {
|
||||
trackEvent({
|
||||
event: "sortOptionClick",
|
||||
filter: {
|
||||
sortOptions: sortOption,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function trackFilterChangeEvent(
|
||||
facilityFilters: string[],
|
||||
surroundingsFilters: string[]
|
||||
) {
|
||||
const filtersUsed = []
|
||||
if (facilityFilters.length) {
|
||||
filtersUsed.push(`hotelfacilities:${facilityFilters.join(",")}`)
|
||||
}
|
||||
if (surroundingsFilters.length) {
|
||||
filtersUsed.push(`hotelsurroundings:${surroundingsFilters.join(",")}`)
|
||||
}
|
||||
|
||||
trackEvent({
|
||||
event: "filterUsed",
|
||||
filter: {
|
||||
filtersUsed: filtersUsed.join("|"),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function trackOpenSidePeekOnDestinationPagesEvent(location: string) {
|
||||
trackEvent({
|
||||
event: "trackOpenSidePeekEvent",
|
||||
cta: {
|
||||
pageName: `explore${location}|sidepeek`,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function trackMapClick(name: string) {
|
||||
trackEvent({
|
||||
event: "map click",
|
||||
map: {
|
||||
action: "map click",
|
||||
clickedItemName: name,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function trackOpenMapView(pageName: string, pageType: string) {
|
||||
trackEvent({
|
||||
event: "openMapView",
|
||||
map: {
|
||||
pageName,
|
||||
pageType,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user