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:
@@ -108,6 +108,8 @@ export function useAnalytics() {
|
||||
customer_email?: string;
|
||||
}) => {
|
||||
try {
|
||||
console.log("[Analytics] Tracking order completed:", order.order_number, "Total:", order.total, order.currency);
|
||||
|
||||
// Track order event
|
||||
op.track("order_completed", {
|
||||
order_id: order.order_id,
|
||||
@@ -120,12 +122,17 @@ export function useAnalytics() {
|
||||
});
|
||||
|
||||
// Track revenue
|
||||
console.log("[Analytics] Tracking revenue:", order.total, order.currency);
|
||||
op.revenue(order.total, {
|
||||
currency: order.currency,
|
||||
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) {
|
||||
console.error("Track error:", e);
|
||||
console.error("[Analytics] Track error:", e);
|
||||
}
|
||||
}, [op]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user