A simple tool to collect and view GitHub repos traffic history longer than 14 days using GitHub Actions.
- Collect traffic metrics for all your repos using GitHub Actions
- A simple web interface to view the stats locally or hosted using GitHub Pages
- A demo website is here: piebro.github.io/github-repo-traffic-stats
- Fork the repo
- Delete the existing data in the
data
andpreview_plots
folders - Change the "owner" in
github_username.txt
and change the websites inindex.html
- Create a GitHub token to access this API: https://docs.github.com/en/rest/metrics/traffic
- Add the token as an Action secret to the repo and name it
GH_TOKEN
- In the settings, enable the Read and Write Action Permissions (to allow the action to push the data to the repo)
All your public repos should now be queried at 23:30 UTC every day.
The data is stored in the data folder.
You can enable GitHub Pages to host the dashboard or host it locally using python -m http.server
in the project root folder.
Contributions are welcome. Open an Issue if you want to report a bug, have an idea or want to propose a change.
There is lightweight tracking with Plausible for the website to get info about how many people are visiting. Everyone who is interested can look at these stats here: https://plausible.io/piebro.github.io%2Fgithub-repo-traffic-stats?period=30d. Only users without an AdBlocker are counted, so these statistics are underestimating the actual count of visitors. I would guess that quite a few people (including me) visiting the site have an AdBlocker.
All code in this project is licensed under the MIT License.