(function () { function fireMetaPurchase() { try { var raw = new URLSearchParams(location.search).get('order_data'); if (!raw) return; // no order data (direct visit/bookmark) → don't log a phantom purchase var orderData = JSON.parse(raw); (orderData.items || []).forEach(function (item) { var tickets = item.tickets || []; fbq('track', 'Purchase', { value: parseFloat(item.amount) || 0, currency: 'USD', content_type: 'product', content_ids: tickets.map(function (t) { return String(t.id); }), contents: tickets.map(function (t) { return { id: String(t.id), quantity: t.quantity, item_price: parseFloat(t.price) || 0 }; }), num_items: tickets.reduce(function (n, t) { return n + (t.quantity || 0); }, 0) }, { eventID: String(item.order_id) }); }); } catch (e) { console.error('Meta Pixel Purchase tracking failed due to', e); } } if (window.fbq) { fireMetaPurchase(); } else { window.addEventListener('load', fireMetaPurchase); } })();


























