Skip to content
(function() {
const paramMap = {
'utm_source': 'ref_site',
'utm_medium': 'ref_type',
'utm_campaign': 'ref_name',
'utm_content': 'u_content',
'utm_term': 'u_term',
'channel': 'u_channel',
'gclid': 'gclid',
'fbc': 'fbc',
'fbp': 'fbp'
};
function injectAttribution() {
const iframe = document.querySelector('iframe[src*="msgsndr.com"]') ||
document.querySelector('iframe[src*="app.gohighlevel.com"]');
if (iframe) {
const urlParams = new URLSearchParams(window.location.search);
let currentUrl = new URL(iframe.src);
let updated = false;
// 1. Map URL Parameters
Object.keys(paramMap).forEach(key => {
let value = urlParams.get(key) || sessionStorage.getItem(key);
if (value) {
currentUrl.searchParams.set(paramMap[key], value);
sessionStorage.setItem(key, value); // Keep for next page
}
});
// 2. Set Landing Page and Referrer
if (!sessionStorage.getItem('u_landing')) {
sessionStorage.setItem('u_landing', window.location.href.split('?')[0]);
}
if (!sessionStorage.getItem('u_referrer')) {
sessionStorage.setItem('u_referrer', document.referrer || 'direct');
}
currentUrl.searchParams.set('u_landing', sessionStorage.getItem('u_landing'));
currentUrl.searchParams.set('u_referrer', sessionStorage.getItem('u_referrer'));
// 3. Update Iframe
if (iframe.src !== currentUrl.toString()) {
iframe.src = currentUrl.toString();
}
}
}
// Run on load and 2 seconds later for safety
window.onload = injectAttribution;
setTimeout(injectAttribution, 2000);
})();