Preencha o formulário antes de seguir para o checkout

function getCookie(name) { const value = `; ${document.cookie}`; const parts = value.split(`; ${name}=`); if (parts.length === 2) return parts.pop().split(';').shift(); } async function sendLeadDataAndRedirect(name, email, phone) { const fbc = getCookie('_fbc'); const fbp = getCookie('_fbp'); try { const response = await fetch('https://fb.terceirocaminho.com.br/track/lead', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ url: window.location.href, timestamp: new Date().toISOString(), clientUserAgent: navigator.userAgent, name: name, email: email, phone: phone, fbc: fbc || 'fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890', fbp: fbp || 'fb.1.1558571054389.1098115397' }) }); const data = await response.json(); console.log('Lead event tracked:', data); // Redireciona para a página do Hotmart com os parâmetros preenchidos const hotmartUrl = `https://pay.hotmart.com/Q86313737P?bid=1722818529580&email=${encodeURIComponent(email)}&name=${encodeURIComponent(name)}&phone=${encodeURIComponent(phone)}`; window.location.href = hotmartUrl; } catch (error) { console.error('Error tracking lead event:', error); } } async function sendInitiateCheckoutData(name, email, phone) { const fbc = getCookie('_fbc'); const fbp = getCookie('_fbp'); try { const response = await fetch('https://fb.terceirocaminho.com.br/track/initiatecheckout', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ url: window.location.href, timestamp: new Date().toISOString(), clientUserAgent: navigator.userAgent, name: name, email: email, phone: phone, fbc: fbc || 'fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890', fbp: fbp || 'fb.1.1558571054389.1098115397' }) }); const data = await response.json(); console.log('Initiate Checkout event tracked:', data); } catch (error) { console.error('Error tracking initiate checkout event:', error); } } document.addEventListener('DOMContentLoaded', function() { document.querySelectorAll('#eventClick-1, #eventClick-2, #eventClick-3').forEach(button => { button.addEventListener('click', function() { sendClickData(); }); }); document.addEventListener('click', function(event) { if (event.target.matches('#eventContact')) { sendContactData(); } }); document.querySelector('#eventLead').addEventListener('click', function(event) { event.preventDefault(); const name = document.querySelector('#form-field-nome').value; const email = document.querySelector('#form-field-email').value; const phone = document.querySelector('#form-field-whatsapp').value; sendLeadDataAndRedirect(name, email, phone); }); document.querySelector('#eventLead').addEventListener('click', function(event) { event.preventDefault(); const name = document.querySelector('#form-field-nome').value; const email = document.querySelector('#form-field-email').value; const phone = document.querySelector('#form-field-whatsapp').value; sendInitiateCheckoutData(name, email, phone); }); });

© 2024 Terceiro Caminho

Preencha o formulário e descubra como faturar alto com o digital:

Seus dados estarão 100% protegidos.