debug: Add console logging for revenue tracking

Add detailed console logs to debug why revenue tracking isn't working:
- Log when trackOrderCompleted is called
- Log revenue amount and currency
- Log success/failure of revenue tracking

This will help identify if the issue is with the op.revenue() call
or if it's failing silently.
This commit is contained in:
Unchained
2026-03-29 20:52:21 +02:00
parent a516b3a536
commit 05b0a64c84

View File

@@ -108,6 +108,8 @@ export function useAnalytics() {
customer_email?: string; customer_email?: string;
}) => { }) => {
try { try {
console.log("[Analytics] Tracking order completed:", order.order_number, "Total:", order.total, order.currency);
// Track order event // Track order event
op.track("order_completed", { op.track("order_completed", {
order_id: order.order_id, order_id: order.order_id,
@@ -120,12 +122,17 @@ export function useAnalytics() {
}); });
// Track revenue // Track revenue
console.log("[Analytics] Tracking revenue:", order.total, order.currency);
op.revenue(order.total, { op.revenue(order.total, {
currency: order.currency, currency: order.currency,
transaction_id: order.order_number, transaction_id: order.order_number,
}).then((result) => {
console.log("[Analytics] Revenue tracked successfully:", result);
}).catch((err) => {
console.error("[Analytics] Revenue tracking failed:", err);
}); });
} catch (e) { } catch (e) {
console.error("Track error:", e); console.error("[Analytics] Track error:", e);
} }
}, [op]); }, [op]);