<script>
function getCookieName(name) {
let cookie = document.cookie;
let search = name + "=";
let result = "";
let offset = end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset !== -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end === -1) {
end = cookie.length;
}
result = unescape(cookie.substring(offset, end));
}
}
return result;
}
</script>
<script>
function getTildaUTM(utm_name) {
let cookie = document.cookie;
let tildautm = "TILDAUTM=";
let result = "";
let offset = end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(tildautm);
if (offset !== -1) {
offset += tildautm.length;
end = cookie.indexOf(";", offset)
if (end === -1) {
end = cookie.length;
}
result = unescape(cookie.substring(offset, end));
offset = result.indexOf(utm_name);
if (offset !== -1) {
offset += utm_name.length+1;
end = result.indexOf("|", offset)
if (end === -1) {
end = result.length;
}
result = unescape(result.substring(offset, end));
}
}
}
return result;
}
</script>
<script>
$(document).ready(function () {
$("form").each(function (i, el) {
$(el).append('<input type="hidden" name="roistat_visit" value="' + getCookieName('roistat_visit') + '">');
});
});
</script>