// Fire InitiateCheckout event
(function() {
const webhookUrl = 'https://hooks.zapier.com/hooks/catch/640908/u7k10iv/'; //
// Try to extract data from URL parameters first
const urlParams = new URLSearchParams(window.location.search);
const conversionData = {
email: urlParams.get('email') || document.querySelector('input[type="email"]')?.value || '',
first_name: urlParams.get('first_name') || urlParams.get('fname') || document.querySelector('input[name="first_name"], input[name="firstName"]')?.value || '',
last_name: urlParams.get('last_name') || urlParams.get('lname') || document.querySelector('input[name="last_name"], input[name="lastName"]')?.value || '',
purchase_value: urlParams.get('price') || urlParams.get('amount') || 47,
event_type: 'InitiateCheckout'
};
// Send to webhook
fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(conversionData)
}).catch(err => console.error('Webhook error:', err));
})();