本项目是一个开箱即用的站点在线人数统计服务,同时开源支持私有化部署。
记录每人在线时间 的 API 呢?
          Room ID (10字符以内)
          Iframe 方式使用 or js 方式使用
          
| Key | Value | 
|---|---|
| room ID | |
| online user | |
| my online time | |
| total online time | 
<center><iframe frameborder=0  height=50px marginwidth=0 scrolling=no src="https://time-counter.onmicrosoft.cn/room/{Room ID}"></iframe></center>xxxxxxxxxx<script src="https://time-counter.onmicrosoft.cn/counter.js" async="" id="online-counter" interval="240" api="https://time-counter.onmicrosoft.cn/counter" room="{Room ID}"></script>
本站当前在线人数 <span style="color: red;" id="online_user"></span> 人
你的在线总时间:  <span style="color: red;" id="online_me"></span>
全站在线总时间:  <span style="color: red;" id="online_total"></span>x
// 若您的网站有 Pjax 等局部热加载技术,请参考以下代码(Pjax 似乎会忽略 script 的标签内传值)。
      本站当前在线人数 <span style="color: red;" id="online_user"></span> 人  你的在线总时间:  <span style="color: red;" id="online_me"></span> 全站在线总时间:  <span style="color: red;" id="online_total"></span>
      <script>    (function () {
      getOnlineUser()
      function getOnlineUser() {    // 移除之前的 online-counter    let oldScript = document.getElementById("online-counter");    if (oldScript) {        oldScript.remove();    }    //create script    let script = document.createElement("script");    script.src = "https://time-counter.onmicrosoft.cn/counter.js";    script.async = true;    script.id = "online-counter";    script.setAttribute("interval", 240);    script.setAttribute("api", "https://time-counter.onmicrosoft.cn/counter");    script.setAttribute("room", "{Room ID}");    document.head.appendChild(script);}
      })()</script>Powered by: 🚀 Gin + Redis ✨