feat(analytics): add behavior and payment funnel tracking

This commit is contained in:
2026-07-14 16:54:13 +08:00
parent ca55723e48
commit 81d6489978
70 changed files with 1576 additions and 81 deletions
+8 -1
View File
@@ -64,6 +64,7 @@ export interface LaunchEzpayRedirectInput {
subscriptionType: PendingPaymentSubscriptionType;
tipCoffeeType?: PendingPaymentTipCoffeeType;
returnTo?: PendingPaymentReturnTo;
onOpened?: () => void;
onFailed: (errorMessage: string) => void;
}
@@ -73,6 +74,7 @@ export async function launchEzpayRedirect({
subscriptionType,
tipCoffeeType,
returnTo,
onOpened,
onFailed,
}: LaunchEzpayRedirectInput): Promise<void> {
log.debug("[payment-launch] launchEzpayRedirect START", {
@@ -121,5 +123,10 @@ export async function launchEzpayRedirect({
subscriptionType,
paymentUrl,
});
window.location.href = paymentUrl;
try {
window.location.href = paymentUrl;
onOpened?.();
} catch {
onFailed("Could not open Ezpay. Please try again.");
}
}