GitHub's web Traffic page only keeps the last 14 days. Gittrack helps you permanently accumulate this data, generating a single-file offline HTML dashboard that you can open by double-clicking.
Zero dependencies (no CDN, no Chart.js), zero third-party accounts — data is inlined into the HTML, and it opens with a double-click via file://.
- ** Live Refresh**: Enter your username + PAT, click refresh to pull the latest 14 days on the spot. PAT is stored only in your browser.
- ** Automatic Daily Collection**: Use GitHub Actions to pull data once a day; history accumulates permanently in a private repo.
- ** Single-file Offline**:
traffic-dashboard.htmlhas inlined data and hand-written SVG — just double-click to open. - ** Multi-repo Auto Discovery**: By default lists all repos under your account; you can also specify explicitly.
- ** Dual View Toggle / 🌐 Bilingual **, etc.
Two data collection methods — use them together, not as an either/or:
| ① Live Refresh | ② Actions Auto Collection | |
|---|---|---|
| Who does it | Browser calls GitHub API | GitHub Actions runs on schedule |
| Can it persist? | ❌ Gone when the page closes | ✅ Permanently accumulated in private repo |
| What you need | A PAT | A private repo + a PAT |
The data source is the GitHub Traffic API, which only returns the last 14 days. Live refresh is for immediate viewing; Actions deposits each day's window into a file — the only way to keep history without gaps.
-
Open
traffic-dashboard.html(it's blank the first time, which is normal). -
Click the gear ⚙, enter your username and PAT (Classic: check
repo; Fine-grained: grantAdministration: Read-only). -
Click "Live Refresh" → list repos → pull 14 days → render.
Under
file://some browsers don't persist localStorage. If the refresh button is greyed out, usepython -m http.serverto start a local server and try again.
Deposit each day's window into a private repo so history accumulates across days without gaps. The script doesn't run persistently — it's checked out and run by GitHub Actions each time.
A. Prepare the Private Data Repo
- Create a new private repo (data repo) to store accumulated history and generated dashboards.
- Copy
.github/workflows/collect-traffic.yml.examplefrom this repo into it, and rename it to.github/workflows/collect-traffic.yml. - Edit the workflow and change
TOOL_REPOto your public tool repo (owner/repo, e.g.fthuu/Gittrack-github-traffic-dashboard). Actions will check it out to.tool/and use the scripts inside. - Place a
config/repos.json(copy the template and modify) to decide which repos to collect:"mode": "auto": Auto-discover all repos under your account (you can filter withinclude_private/include_forks/include_archived/max_repos/include_patterns/exclude_patternsin theautoblock)."mode": "explicit": Only collect repos explicitly listed in thereposarray (also suitable for repos authorized to you by others).
- In the data repo, go to Settings → Secrets and variables → Actions → New repository secret and create
TRAFFIC_TOKENusing a PAT that can read Traffic for the target repos (the Traffic API actually requires push-level permissions):- Classic PAT: check the
reposcope. - Fine-grained PAT:
Permissions → Administration: Read-only, and select authorization for the target repos underRepository access.
- Classic PAT: check the
B. Trigger & Verify
- Go to the data repo Actions → Collect GitHub Traffic → Run workflow and run it once manually for verification. You can expand the
workflow_dispatchoptions:repos: Only collect specified repos (owner/repo,owner2/repo2); leave empty to useconfig/repos.json.mode:auto/explicit, overrides settings inrepos.json.dry_run: Only fetch and print, no file writes, no commits (for troubleshooting).skip_referrers: Skip referrers / popular paths archiving.
- After a successful run, the data repo will have an updated
data/traffic-history.jsonanddashboard.html, auto-committed (skipped if data hasn't changed). Opendashboard.htmlto see accumulated history.
C. Automatic Daily Runs Afterward
After that, it runs automatically every day at UTC 02:00 (Beijing time 10:00) (cron 0 2 * * *). History starts from the day you first successfully collected — there's no fixed starting point.
⚠️ GitHub doesn't guarantee exact timing; it may be delayed by tens of minutes during peak hours. Repos with no commits for 60 days will have scheduled tasks disabled — keep having traffic or manually trigger to prevent this. To backfill earlier history, you can useseed_from_csv.pyto merge exported CSVs intodata/traffic-history.json(see the script's--helpfor details).
Badge states: grey (no credentials configured) / blue (inline seed, snapshot accumulated by Actions) / green (just live-refreshed). Opening the dashboard shows Actions-accumulated history; clicking refresh merges the latest 14 days in (without duplicate counting). Note: live-refreshed data only exists in memory and is not written back to files — to persist permanently, you must use Actions.
Click EN / 中文 in the upper right corner to switch languages; preference is stored in localStorage.
The tool repo contains no real data and is safe to make public: traffic-dashboard.html generated with --empty opens as blank;
.gitignore blocks data/traffic-history.json and *.csv; PATs are only stored in GitHub Secrets or browser localStorage.
Iron rule: Public repos generating dashboards must use --empty; accumulated history goes only in private repos.
SPDX-License-Identifier: GPL-3.0-only
Copyright (c) 2026 fthuu
Licensed under GNU GPL v3.0 only — see LICENSE.
- Xiaohongshu / Rednote:@Epho
- GitHub:https://github.com/fthuu
GitHub 网页上的 Traffic 只保留最近 14 天。Gittrack 帮你把这段数据永久累积,生成一个可双击打开的单文件离线 HTML 看板。
零依赖(不引 CDN、不需要 Chart.js)、零第三方账号,数据内联进 HTML,file:// 双击即开。
![]() |
![]() |
| 主看板:状态徽标、仓库芯片、汇总卡片、Views/Clones 双折线 | 流量来源 Top 10 + 热门路径 Top 10 |
![]() |
![]() |
| 每日明细表(支持 14 天 / 30 天 / 全部) | 实时刷新面板:填用户名 + PAT,存本浏览器 localStorage |
- ** 实时刷新**:填用户名 + PAT,点刷新就地拉取最新 14 天,PAT 只存本浏览器。
- ** 自动每日采集**:用 GitHub Actions 每天拉一次,历史在私有仓库永久累积。
- ** 单文件离线**:
traffic-dashboard.html数据内联、手写 SVG,双击直开。 - ** 多仓库自动发现**:默认列出你名下所有仓库,也可显式指定。
- ** 双视图切换 / 🌐 中英文 ** 等。
两种取数方式,叠加使用,不是二选一:
| ① 实时刷新 | ② Actions 自动采集 | |
|---|---|---|
| 谁来做 | 浏览器调 GitHub API | GitHub Actions 每天定时跑 |
| 能留存吗 | ❌ 关页即失 | ✅ 永久累积到私有仓库 |
| 需要准备 | 一个 PAT | 一个私有仓库 + 一个 PAT |
数据源都是 GitHub Traffic API,它只返回最近 14 天。实时刷新看完就扔; Actions 把每天的窗口沉淀到文件,是唯一能让历史不断档的方式。
-
打开
traffic-dashboard.html(首次空白,属正常)。 -
点齿轮 ⚙,填用户名与 PAT(Classic 勾
repo;Fine-grained 给Administration: Read-only)。 -
点「实时刷新」→ 列出仓库 → 拉取 14 天 → 渲染。
file://下部分浏览器不持久化 localStorage,刷新按钮灰了就用python -m http.server起服务再开。
把每日窗口沉淀到私有仓库,历史才能跨天累积、不断档。脚本不常驻,每次由 GitHub Actions 临时检出运行。
A. 准备私有数据仓库
- 新建一个私有仓库(数据仓库),用来存放累积的历史与生成的个人看板。
- 把本仓库的
.github/workflows/collect-traffic.yml.example复制进去,改名为.github/workflows/collect-traffic.yml。 - 编辑该 workflow,把
TOOL_REPO改成你的公开工具仓库(owner/repo,例如fthuu/Gittrack-github-traffic-dashboard)。Actions 会把它检出到.tool/并使用里面的脚本。 - 放一份
config/repos.json(复制模板再改),决定采集哪些仓库:"mode": "auto":自动发现你名下所有仓库(可在auto里用include_private/include_forks/include_archived/max_repos/include_patterns/exclude_patterns过滤)。"mode": "explicit":只采集repos数组里显式列出的仓库(也适合补充采集别人授权给你的仓库)。
- 在数据仓库 Settings → Secrets and variables → Actions → New repository secret 新建
TRAFFIC_TOKEN,用能读取目标仓库 Traffic 的 PAT(Traffic API 实际要求 push 级权限,按下面选范围):- Classic PAT:勾选
repo范围。 - Fine-grained PAT:
Permissions → Administration: Read-only,并在Repository access选中对目标仓库的授权。
- Classic PAT:勾选
B. 触发与验证
- 进入数据仓库 Actions → Collect GitHub Traffic → Run workflow 手动跑一次做验证。可展开
workflow_dispatch选项:repos:只采集指定仓库(owner/repo,owner2/repo2),留空则用config/repos.json。mode:auto/explicit,覆盖repos.json里的设置。dry_run:只拉取并打印,不写文件、不提交(排查用)。skip_referrers:跳过 referrers / popular paths 归档。
- 跑成功后,数据仓库会多出 / 更新
data/traffic-history.json和dashboard.html,并自动提交(数据无变化则跳过提交)。打开dashboard.html即可看到累积的历史。
C. 之后每天自动跑
之后每天 UTC 02:00(北京时间 10:00) 自动执行(cron 0 2 * * *)。历史从你第一次成功采集那天开始,无固定起点。
⚠️ GitHub 不保证准点,高峰期可能延迟数十分钟;仓库 60 天无任何提交会停用定时任务——保持有流量或有手动触发即可。 想回填更早的历史,可用seed_from_csv.py把导出的 CSV 合并进data/traffic-history.json(详见脚本--help)。
徽标三态:灰(没配凭据)/ 蓝(内联种子,Actions 沉淀的快照)/ 绿(刚实时刷新过)。 打开看板看到的是 Actions 累积的历史;点刷新则把最新 14 天合并进来(不重复计算)。 注意:实时刷新的数据只在内存,不会写回文件,想永久留存只能靠 Actions。
点右上角 EN / 中文 切换,偏好存 localStorage。
工具仓库不含任何真实数据,可放心公开:--empty 生成的 traffic-dashboard.html 打开即空白;
.gitignore 已拦截 data/traffic-history.json、*.csv;PAT 只存 GitHub Secrets 或浏览器 localStorage。
铁律:公开仓库生成看板必须带 --empty;累积历史只放私有仓库。
SPDX-License-Identifier: GPL-3.0-only
Copyright (c) 2026 fthuu
基于 GNU GPL v3.0 only 开源 — 见 LICENSE。
- Xiaohongshu / Rednote:@Epho
- GitHub:https://github.com/fthuu



