<script>
// ✅ Replace with your actual Google Ads Conversion ID/Label
const GC_SEND_TO = 'AW-10973713802'; // send_to
function getRawFormValues() {
const fullName = document.querySelector('#form866149246 input[name="Name"]')?.value?.trim() || '';
const email = document.querySelector('#form866149246 input[name="Email"]')?.value?.trim() || '';
// IMPORTANT: use the hidden "Phone" field value as-is (full number produced by Tilda)
const phoneRaw = document.querySelector('#form866149246 input[name="Phone"]')?.value?.trim() || '';
return { fullName, email, phoneRaw };
}
(function attachECForForm(){
const form = document.getElementById('form866149246');
if (!form) return;
form.addEventListener('submit', function() {
try {
const { fullName, email, phoneRaw } = getRawFormValues();
// Store exact values to send from the thank-you page
const payload = {
email: (email || '').toLowerCase(),
phone_number: phoneRaw, // as-is
full_name: fullName, // keep full name, we'll map it to address.first_name later
ts: Date.now()
};
sessionStorage.setItem('ec_user_data', JSON.stringify(payload));
sessionStorage.setItem('ec_send_to', GC_SEND_TO);
} catch(e) {
console.warn('EC pre-store failed', e);
}
});
})();
</script>