<!-- BEGIN YCSLID GET HIDDEN -->
<script>
jQuery(document).ready(function($){
function setCookie(n, v, o) { o = o || {}; var expires = o.expires; if (typeof expires == "number" && expires) { var d = new Date(); d.setTime(d.getTime() + expires * 1000); expires = o.expires = d; } if (expires && expires.toUTCString) { o.expires = expires.toUTCString(); } v = encodeURIComponent(v); var updatedCookie = n + "=" + v; for (var propName in o) { updatedCookie += "; " + propName; var propValue = o[propName]; if (propValue !== true) { updatedCookie += "=" + propValue; } } document.cookie = updatedCookie; }
function getCookie(n) { var matches = document.cookie.match(new RegExp("(?:^|; )" + n.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)")); return matches ? decodeURIComponent(matches[1]) : undefined; }
function getUrlVars() { let e = {}; window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (n, o, t) { e[o] = decodeURIComponent(t) }); return e }
// Если есть GET-параметр, то записываем его в куки
const urlVars = getUrlVars();
if (urlVars.ysclid) {
setCookie('ysclid', urlVars.ysclid, { expires: 31536000, path: '/' });
}
// Достаем из куки параметр и добавляем в формы
const ysclid = getCookie('ysclid');
if (ysclid && ysclid.length) {
$('form').each(function () {
$(this).append('<input type="hidden" name="ysclid" value="'ysclid'">');
});
}
});
</script>
<!-- END YCSLID GET HIDDEN -->