Tracking payment start event
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import type { TrackingPosition, TrackingSDKData } from "@/types/components/tracking"
|
||||
import type {
|
||||
PaymentEvent,
|
||||
TrackingPosition,
|
||||
TrackingSDKData,
|
||||
} from "@/types/components/tracking"
|
||||
|
||||
export function trackClick(name: string) {
|
||||
pushToDataLayer({
|
||||
@@ -40,6 +44,23 @@ export function trackUpdatePaymentMethod(hotelId: string, method: string) {
|
||||
pushToDataLayer(paymentSelectionEvent)
|
||||
}
|
||||
|
||||
export function trackPaymentEvent(paymentEvent: PaymentEvent) {
|
||||
const paymentAttempt = {
|
||||
event: paymentEvent.event,
|
||||
hotelInfo: {
|
||||
hotelId: paymentEvent.hotelId,
|
||||
},
|
||||
paymentInfo: {
|
||||
isSavedCreditCard: paymentEvent.isSavedCreditCard,
|
||||
status: "attempt",
|
||||
type: paymentEvent.method,
|
||||
smsEnable: paymentEvent.smsEnable,
|
||||
errorMessage: paymentEvent.errorMessage,
|
||||
},
|
||||
}
|
||||
pushToDataLayer(paymentAttempt)
|
||||
}
|
||||
|
||||
function pushToDataLayer(data: any) {
|
||||
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
||||
console.log("TRACKING: Pushing to datalayer", data)
|
||||
|
||||
Reference in New Issue
Block a user