(function () {
function getParam(name) {
try { return new URL(window.location.href).searchParams.get(name); }
catch (e) { return null; }
}
function setCookie(name, value, days) {
if (!value) return;
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
document.cookie = name + "=" + encodeURIComponent(value) + "; expires=" + date.toUTCString() + "; path=/; SameSite=Lax";
}
function getCookie(name) {
var key = name + "=";
var parts = document.cookie.split(";");
for (var i = 0; i < parts.length; i++) { var c = parts[i].trim(); if (c.indexOf(key) === 0) return decodeURIComponent(c.substring(key.length)); } return ""; } var gclidFromUrl = getParam("gclid"); if (gclidFromUrl) setCookie("lp_gclid", gclidFromUrl, 90); function patchOpenApplyIframes() { var gclid = getCookie("lp_gclid"); if (!gclid) return; var iframes = document.querySelectorAll("iframe"); for (var i = 0; i < iframes.length; i++) { var iframe = iframes[i]; var src = iframe.getAttribute("src") || ""; if (!src) continue; // Match any OpenApply iframe if (src.indexOf("openapply") === -1) continue; if (src.indexOf("gclid=") !== -1) continue; var joiner = src.indexOf("?") === -1 ? "?" : "&"; iframe.setAttribute("src", src + joiner + "gclid=" + encodeURIComponent(gclid)); } } var attempts = 0; var maxAttempts = 120; // about 30 seconds var interval = setInterval(function () { attempts++; patchOpenApplyIframes(); if (attempts >= maxAttempts) clearInterval(interval);
}, 250);
})();