Thank You!
We've Received Your Information!
Your Free Medicare Materials Are Ready! Download Below
A licensed insurance agent will be in touch shortly to review your Medicare Advantage options and guide you through the best choices for your needs.
add_action('wp_footer', function () {
if (!is_page('t65-medicare-advantage-ga/thank-you')) return;
?>
<script>
(function() {
// Helper: read query string
function qp(name) {
const m = new URLSearchParams(window.location.search).get(name);
return m ? m.trim() : '';
}
// Normalize
function toLower(s){ return (s || '').trim().toLowerCase(); }
function normalizePhoneE164(raw){
// Expect US by default; allow country override via &country=XX
const cc = toLower(qp('country')) || 'us';
let digits = (raw || '').replace(/[^\d+]/g,'');
if (!digits.startsWith('+')) {
// Prepend +1 for US if no +country
if (cc === 'us') digits = '+1' + digits.replace(/^1/,'');
else digits = '+' + digits; // fallback, assumes caller passed country code
}
return digits;
}
// Collect values from query string
var email = toLower(qp('email'));
var phone = qp('phone');
var fname = toLower(qp('fname'));
var lname = toLower(qp('lname'));
var city = toLower(qp('city'));
var region = toLower(qp('region')); // state/region (e.g., FL)
var postal = toLower(qp('postal_code'));
var country = toLower(qp('country')) || 'us';
// Gmail normalization: remove dots before @ for gmail/googlemail
if (email && /@(gmail\.com|googlemail\.com)$/i.test(email)) {
const parts = email.split('@');
parts[0] = parts[0].replace(/\./g, '');
email = parts.join('@');
}
// Prepare user_data object (send UNHASHED; Google will hash)
var userData = {};
if (email) userData.email = email;
if (phone) userData.phone_number = normalizePhoneE164(phone);
// Address requires: first_name, last_name, postal_code, country (2-letter), optional city/region/street
var addressObj = {};
if (fname) addressObj.first_name = fname;
if (lname) addressObj.last_name = lname;
if (postal) addressObj.postal_code = postal;
if (country) addressObj.country = country.toUpperCase();
if (city) addressObj.city = city;
if (region) addressObj.region = region;
// Only attach address if we have the required minimum
if (addressObj.first_name && addressObj.last_name && addressObj.postal_code && addressObj.country) {
userData.address = addressObj;
}
// Send user_data BEFORE the conversion event fires
if (window.gtag && (userData.email || userData.phone_number || userData.address)) {
gtag('set', 'user_data', userData);
}
// OPTIONAL: Immediately trigger the Ads conversion event here if your site currently relies on URL-only conversion.
// Replace 'AW-CONVERSION_ID/CONVERSION_LABEL' with your actual values,
// or keep relying on the existing event snippet already on this page.
// gtag('event', 'conversion', {'send_to': 'AW-XXXXXXXXX/XXXXXXXXXXXX'});
})();
</script>
<?php
}, 99);
Note: These resources are for informational purposes only. For personalized assistance, a licensed insurance agent can walk you through each topic.
© 2026 Movely. All Rights Reserved.