码桶

发现社区成员的开源项目

geekssl /

wstats

公开
main
wstats/public/assets/metrics-NUijxW6Y.js
metrics-NUijxW6Y.js9.8 KB
const t=[{key:"pv",zh:{name:"浏览量(PV)",def:"页面被打开的次数,SDK 每上报一次 pageview 事件计 1。",src:"events 表(type=pageview),按天汇总后取 site_daily 快路径",note:"刷新、前进后退重开同一页面都会重复计入。"},en:{name:"Pageviews (PV)",def:"Number of page opens; +1 per pageview event reported by the SDK.",src:"table events (type=pageview), rolled up per day into site_daily",note:"Refreshing or re-opening the same page counts again."}},{key:"uv",zh:{name:"独立访客(UV)",def:"去重后的访客数,按 visitor_id(浏览器 cookie,有效期 2 年)。",src:"概览取 Redis HyperLogLog 多日合并(PFCOUNT);Redis 不可用时回退 events 去重",note:"⚠ 概览 UV 是估算值(误差约 0.81%),「访问与访客」页按 sessions 精确去重,两者可能相差几个数属正常。"},en:{name:"Unique visitors (UV)",def:"De-duplicated visitors, keyed by visitor_id (browser cookie, 2-year TTL).",src:"Overview uses Redis HyperLogLog merged across days (PFCOUNT); falls back to DISTINCT on events",note:"⚠ Overview UV is an estimate (~0.81% error); the Visitors page de-duplicates exactly from sessions. A small gap is expected."}},{key:"ipc",zh:{name:"IP 数",def:"去重后的客户端 IP 数量。",src:"同 UV:Redis HLL(ip:{site_id}:{Ymd} → PFCOUNT)",note:"同一办公网或移动基站下多个访客可能共用一个出口 IP,故 IP 数通常小于 UV。"},en:{name:"IPs",def:"De-duplicated client IP count.",src:"Same as UV: Redis HLL (ip:{site_id}:{Ymd} → PFCOUNT)",note:"Visitors behind one office NAT or mobile carrier may share an IP, so IPs is usually below UV."}},{key:"visits",zh:{name:"访问次数(会话)",def:"一次会话算一次访问;30 分钟无操作即视为新会话。",src:"sessions 表 COUNT(*),按 start_ts 换算成站点本地日归属",note:"与 PV 不同:一次访问可包含多个浏览量。"},en:{name:"Visits (sessions)",def:"One session counts as one visit; 30 minutes of inactivity starts a new session.",src:"sessions COUNT(*), bucketed by start_ts into the site-local day",note:"Different from PV: one visit may contain several pageviews."}},{key:"bounce_rate",zh:{name:"跳出率",def:"只浏览了 1 个页面的会话占比 = 单页会话数 ÷ 会话数。",src:"sessions.bounce 之和 ÷ sessions 行数",note:"口径完全基于会话。PV 很高但跳出率也高,说明落地页留不住人。"},en:{name:"Bounce rate",def:"Share of sessions that viewed only one page = single-page sessions ÷ sessions.",src:"SUM(sessions.bounce) ÷ COUNT(sessions)",note:"Purely session-based. High PV together with high bounce means the landing page fails to retain."}},{key:"avg_duration",zh:{name:"平均停留时长",def:"会话总时长 ÷ 会话数。",src:"AVG(sessions.duration)",note:"会话最后一个页面的停留时间无法测量,因此整体略偏小;单页会话按 0 计。"},en:{name:"Avg. duration",def:"Total session duration ÷ number of sessions.",src:"AVG(sessions.duration)",note:"The dwell time on a session’s last page is unmeasurable, so this reads slightly low; single-page sessions count as 0."}},{key:"new_users",zh:{name:"新访客",def:"区间内首次出现的访客数。",src:"sessions.is_new 汇总",note:"「新」以 visitor_id 是否首次出现为准,访客清空 cookie 后会被重新计为新访客。"},en:{name:"New visitors",def:"Visitors seen for the first time within the range.",src:"SUM(sessions.is_new)",note:'Based on first-seen visitor_id; clearing cookies makes a visitor "new" again.'}},{key:"old_users",zh:{name:"老访客",def:"独立访客 − 新访客。",src:"UV(Redis HLL)− 新访客",note:"因 UV 取自 HLL,老访客为推算值,可能存在 ±1~2 的抖动。"},en:{name:"Returning visitors",def:"Unique visitors − new visitors.",src:"UV (Redis HLL) − new visitors",note:"Derived from an HLL estimate, so it may jitter by ±1–2."}},{key:"conversion",zh:{name:"转化率(漏斗)",def:"完成全部步骤的会话数 ÷ 第一步的会话数。",src:"events 按 session_id 去重",note:"⚠ 默认「有序」:步骤必须按时间先后依次发生;关闭该开关后,只要区间内命中过全部步骤即计入,转化率会偏高。"},en:{name:"Conversion (funnel)",def:"Sessions completing all steps ÷ sessions reaching step 1.",src:"events de-duplicated by session_id",note:'⚠ "Ordered" is on by default: steps must occur in chronological order. Turning it off counts any session hitting all steps, inflating the rate.'}},{key:"online",zh:{name:"实时在线",def:"最近 5 分钟内活跃过的会话数。",src:"Redis zset on:{site_id},读取时按 now−300 过滤",note:"通常略大于「进行中会话」,后者要求 30 分钟内的活跃会话。"},en:{name:"Online now",def:"Sessions active within the last 5 minutes.",src:"Redis zset on:{site_id}, filtered by now−300 on read",note:'Usually slightly larger than "live sessions", which requires activity within 30 minutes.'}},{key:"geo",zh:{name:"IP 地域",def:"由 IP 离线库(ip2region)解析出的国家 / 省份 / 城市。",src:"采集时写入 events 与 sessions 的 country / province / city 字段",note:"内网、保留地址与库未收录的 IP 会留空;「IP 地域」页同时给出「总会话」与「已识别会话」两个分母,避免误判为丢数据。"},en:{name:"Geo (IP)",def:"Country / province / city resolved from the offline ip2region database.",src:"Resolved at collect time into events & sessions (country / province / city)",note:'Private, reserved and unknown IPs stay empty; the Geo page shows both "all sessions" and "identified sessions" as denominators.'}}],o={zh:{events:{title:"按事件发生日归属(events.day)",pages:"概览的浏览量/独立访客、来源分析、广告追踪、用户旅程、热力图、转化漏斗",desc:"事件在上报时写入站点本地日,跨零点的会话会把事件拆到两天。"},sessions:{title:"按会话开始日归属(sessions.start_ts)",pages:"概览的访问次数/跳出率/停留时长、访问与访客、受众分析、IP 地域、数据大屏",desc:"跨零点的会话整体归属到开始那一天,因此和上面那组的日切边界存在差异。"},tip:"同一区间内,按事件日与按会话日统计出的数字本就不会完全相同,这是口径差异,不是数据丢失。"},en:{events:{title:"Attributed by event day (events.day)",pages:"Overview PV/UV, Sources, Ads, Journey, Heatmap, Funnels",desc:"Events store the site-local day at collect time; a session crossing midnight splits across two days."},sessions:{title:"Attributed by session start day (sessions.start_ts)",pages:"Overview visits/bounce/duration, Visitors, Audience, Geo, Big screen",desc:"A session crossing midnight is attributed entirely to its start day, so day boundaries differ from the group above."},tip:"Within one range, event-day and session-day figures are not expected to be identical — that is a definition difference, not data loss."}},a={zh:[{q:"概览的 UV 和「访问与访客」的 UV 差几个数",a:"概览走 Redis HyperLogLog 估算(快、支持多日合并),受众页按 sessions 精确去重。估算误差约 0.81%,属正常。"},{q:"同一区间的 PV 和访问次数对不上",a:"两者根本不是同一个指标:PV 是页面打开次数,访问次数是会话数,一次访问可含多个 PV。"},{q:"昨天和今天的数字在跨零点时段有出入",a:"浏览量/来源/广告等按「事件发生日」归属,会话/地域/受众按「会话开始日」归属,跨零点会话会被两种口径分到不同的天。"},{q:"新访客 + 老访客不等于 UV",a:"老访客是「UV − 新访客」推算出来的,而 UV 本身是 HLL 估算值,因此合计会有 ±1~2 的抖动。"},{q:"地域表里的会话数比总会话少",a:"内网、保留地址以及离线库未收录的 IP 解析不出地域,会留空。「IP 地域」页给出「总会话/已识别会话」两个分母,不是丢数据。"},{q:"漏斗转化率偏高",a:"确认「有序」开关是否被关掉。关闭后只要求区间内命中过全部步骤,不要求先后顺序,转化率会明显虚高。"},{q:"刚发生的访问在面板上还没出现",a:"明细落库依赖常驻的队列消费进程(worker)与小时级汇总(cron rollup)。今日 PV 会用 Redis 实时数即时覆盖,其余指标可能有一小段延迟。"}],en:[{q:"Overview UV differs from the Visitors page UV by a few",a:"Overview uses a Redis HyperLogLog estimate (fast, mergeable across days); the Visitors page de-duplicates exactly from sessions. ~0.81% error is expected."},{q:"PV and visits do not match for the same range",a:"They are different metrics: PV counts page opens, visits counts sessions — one visit can contain several pageviews."},{q:"Numbers look off around midnight",a:"PV/Sources/Ads attribute by event day; sessions/Geo/Audience attribute by session start day. A session crossing midnight lands on different days under each rule."},{q:"New + returning visitors ≠ UV",a:"Returning visitors is derived as UV − new, and UV itself is an HLL estimate, so the sum jitters by ±1–2."},{q:"The geo table shows fewer sessions than total",a:'Private, reserved and unknown IPs resolve to nothing and stay empty. The Geo page shows both "all sessions" and "identified sessions" denominators — nothing is lost.'},{q:"Funnel conversion looks inflated",a:'Check whether the "Ordered" switch is off. With it off, any session hitting all steps counts regardless of order, inflating the rate.'},{q:"A recent visit is not on the dashboard yet",a:"Detail persistence relies on the always-on queue worker plus hourly rollup (cron rollup). Today’s PV is overridden with the live Redis counter; other metrics may lag briefly."}]};function r(s,i){const e=t.find(n=>n.key===s);return e?i==="en-US"?e.en:e.zh:null}export{t as M,o as T,a as W,r as m};