SiteAnalysis

网站访问统计查询

无需注册登录,嵌入统计代码即自动开始统计;数据默认公开,任何人可查询,站长可设置访问密码
如何接入网站统计?(点击查看嵌入代码)
<script>
//启动统计: 不写入任何数据至本地,不依赖cookie及本地数据
var script = document.createElement('script');
const url = `${window.location.protocol}//web-analysis.4asport.com/api.php`;
const timeend = `${url}?t=timeend&url=${window.location.href}`;
const log = `${url}?t=log`;
script.src = `${url}?t=analysis&r=${encodeURIComponent(document.referrer)}&u=${encodeURIComponent(window.location.href)}&v=${screen.width}x${screen.height}`;
document.head.appendChild(script);
document.onvisibilitychange = () => {
  if (document.visibilityState === "hidden") {
    navigator.sendBeacon(timeend);
  }
};
document.addEventListener('click', function(event) {
    var x = event.clientX;
    var y = event.clientY;
    var clickedElement = document.elementFromPoint(x, y);
    var elementContent = clickedElement.textContent || clickedElement.innerText || clickedElement.value;
    var data={ x:x, y:y, content:elementContent.substr(25) }
    navigator.sendBeacon(log,JSON.stringify(data));
});
document.onscrollend = (event) => {
    const scrollTop = document.documentElement.scrollTop;
    navigator.sendBeacon(log,JSON.stringify({ scroll:scrollTop }));
};
</script>
将以上代码嵌入网站页面即可开始统计;站长若想隐藏数据,可在对应域名统计页点击「站长管理」,通过网站根目录 TXT 文件识别后设置访问密码。