(function (){
'use strict';
if(typeof window.viCollect==='undefined'||! window.viCollect.url){
return;
}
var sent=false;
function collect(){
if(sent){
return;
}
sent=true;
var body=new URLSearchParams();
body.set('action', 'vi_collect');
body.set('u', window.location.href);
body.set('r', document.referrer||'');
body.set('tz', String(-new Date().getTimezoneOffset()) );
body.set('sw', String(( window.screen&&window.screen.width)||0) );
body.set('sh', String(( window.screen&&window.screen.height)||0) );
body.set('lang',(navigator.language||'').substring(0, 20) );
body.set('wd', navigator.webdriver ? '1':'0');
body.set('vis', document.visibilityState==='visible' ? '1':'0');
fetch(window.viCollect.url, {
method: 'POST',
body: body,
credentials: 'omit',
keepalive: true,
cache: 'no-store'
}).catch(function (){
});
}
if(document.visibilityState==='prerender'){
document.addEventListener('visibilitychange', function handler(){
if(document.visibilityState!=='prerender'){
document.removeEventListener('visibilitychange', handler);
collect();
}});
}else if(document.readyState==='loading'){
document.addEventListener('DOMContentLoaded', collect);
}else{
collect();
}}());