A GitHub CLI extension that shows repository traffic — views, clones and top referrers — as formatted tables, for one repo or several at once.
GitHub only keeps 14 days of traffic data and only shows it to people with push access, so this is a quick way to read it from the terminal and compare repos side by side.
gh extension install imagewize/gh-trafficNeeds gh (authenticated) and jq.
gh traffic imagewize/nynaeve # views (default)
gh traffic --all imagewize/nynaeve imagewize/wp-ops
gh traffic --clones --days 7 imagewize/nynaeve
gh traffic --all --summary imagewize/nynaeve imagewize/wp-ops imagewize/aludra
gh traffic --all --json imagewize/nynaeve # machine-readable
gh traffic --help| Flag | Effect |
|---|---|
-c, --clones |
Include clone counts |
-r, --referrers |
Include top referring sites |
-a, --all |
Views, clones and referrers |
-d, --days N |
Limit day-series sections to the last N days (max 14) |
-s, --summary |
Only the cross-repo rollup table |
--sort-by COL |
Sort the summary by unique-views or unique-clones |
-j, --json |
Raw JSON instead of tables |
-q, --quiet |
Suppress header rows |
With more than one repo, a summary table (one row per repo, 14-day totals) is printed first.
Views count page loads by humans. Clones count git clone, which is dominated by CI runners, mirrors and package resolvers rather than people. A repo with 3 unique viewers and 200 unique cloners is being fetched by automation, not read.
For longer-term tracking, run it on a schedule and append the --json output to a file — GitHub will not give you more than two weeks back.
This started as scripts/git/gh-traffic.sh in imagewize/wp-ops and moved here because it has nothing to do with WordPress.
MIT. See LICENSE.md.