<!--КОД ДЛЯ ЧТЕНИЯ И ПРИМЕНЕИЯ UTM-->
<script>
document.addEventListener("DOMContentLoaded", function() {
(function () {
const locSearch = location.search;
const locSearchArr = locSearch.split('&');
setTimeout(function() {
if(locSearch!=''){
document.querySelector('.t706 input[name="utm"]').value = locSearch;
for(let i=0; i<locSearchArr.length; i++){
if(locSearchArr[i].includes('ta=')){
const tableNum = +locSearchArr[i].split('=')[1] - 1;
const tables = document.querySelectorAll('.t706 input[name="table"]');
if(tables.length) tables[tableNum].click();
const deliveryvar = document.querySelectorAll('.t706 input[name="deliveryvar"]');
if(deliveryvar.length) deliveryvar[0].click();
};
if(locSearchArr[i].includes('pr=')){
const promoWord = locSearchArr[i].split('=')[1];
const promoWrapper = document.querySelector('.t706 .t-inputpromocode__wrapper');
if(promoWrapper!=null){
promoWrapper.querySelector('input').value = promoWord;
promoWrapper.querySelector('.t-btn').click();
};
};
};
};
}, 1000);
})();
});
</script>