} catch (e) { /* */ } } //FINGERPRINT statParams.fingerprint = t_stat__getFingerPrint(); //FLAG inited isInited = true; } function t_stat__pageView(opts) { var staturl = 'https://stat.tildaapi.' + t_stat__getRootZone() + '/event/'; if (!isCookieDisabled) { //RECREATE COOKIE var sessid = t_stat__getCookie('tildasid') || ''; if (sessid != statParams.sessionid) { t_stat__setCookie('tildasid', statParams.sessionid, { expires: 1800, path: '/' }); } } //get previous url if (statParams.referrer === '') { statParams.referrer = t_stat__getCookie('previousUrl') || ''; } statParams.tildautm = t_stat__getCookie('TILDAUTM') || ''; if (!statParams.page) { console.log('TildaStat: page empty'); statParams.page = t_stat__getPageURL(); if (window.location.hash && window.location.hash.indexOf('#!') === 0) { statParams.page += window.location.hash; } } //for events like /tilda/readtime/ adding domain if (statParams.page.substring(0, 1) === '/') { statParams.page = window.location.hostname + statParams.page; } var encodingStat = t_stat__endcodeObj(statParams); var currentPage = t_stat__getPageURL(); if (allRec && (statParams.page === currentPage || statParams.page === currentPage + window.location.hash)) { var postUid = allRec.getAttribute('data-tilda-post-uid'); var productUid = allRec.getAttribute('data-product-uid'); if (!postUid && !productUid) { // каталог 1.2 с фолбэком на 1.1; пустой data-product-uid пропускаем var productSnippet = document.querySelector( '.t-catalog__product-snippet[data-product-uid]:not([data-product-uid=""]),' + '.t-store__product-snippet[data-product-uid]:not([data-product-uid=""])' ); productUid = productSnippet && productSnippet.getAttribute('data-product-uid'); } if (postUid) { encodingStat += '&postuid=' + encodeURIComponent(postUid); } else if (productUid) { encodingStat += '&productuid=' + encodeURIComponent(productUid); } } var xhr = new XMLHttpRequest(); xhr.open('POST', staturl, true); xhr.withCredentials = false; // xhr.setRequestHeader('Content-Type', 'text/plain;charset=UTF-8'); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xhr.onerror = function (data) { console.error('TildaStat: fail pageview '); console.error(data); }; xhr.timeout = 3000; xhr.send(encodingStat); if ( statParams.page && statParams.page.indexOf('tilda/scroll') === -1 && statParams.page.indexOf('tilda/readtime') === -1 && statParams.page.indexOf('tilda/click') === -1 && statParams.page.indexOf('tilda/cookieenabled') === -1 ) { statParams.referrer = statParams.page; if (!isCookieDisabled) { t_stat__setCookie('previousUrl', statParams.page, { path: '/', expires: 1800 });