<script>
document.addEventListener("DOMContentLoaded", function () {
const urlParams = new URLSearchParams(window.location.search);
const name = urlParams.get("utm_term");
if (name) {
// ищем все элементы, в которых встречается %name%
const elements = document.querySelectorAll("body *:not(script):not(style)");
elements.forEach(el => {
if (el.childNodes.length > 0) {
el.childNodes.forEach(node => {
if (node.nodeType === Node.TEXT_NODE && node.nodeValue.includes("%name%")) {
node.nodeValue = node.nodeValue.replace(/%name%/g, name);
}
});
}
});
}
});
</script>