19

Is it possible to track and view/analyze traffic to a GitHub repository (possibly with referrers information) for a period longer than 14 days? That seems to be the longest period that I can see via GitHub "Traffic" graph.

From another answer, suggesting to use badges and some third party service, I navigated to a blogpost, claiming that Github now caches images from READMEs, and thus this solution won't work either, reportedly.

2
  • Sounds like a simple fix with a little IFTTT ifttt.com/recipes?channel=github&page=1 May 21 '14 at 21:41
  • @designerWhoCodes: would you care to elaborate? at the link you provided, I see some 200 "github recipes", but after reading through the first few pages I can't seem to find one to mention anything like "traffic" or "visitors"?
    – akavel
    May 23 '14 at 10:55
7

Not possible as of 2015-05-19

I wrote this message https://github.com/isaacs/github/issues/399 to https://github.com/contact and Ivan Žužak replied by email:

Not possible currently, but thanks for your +1 -- I'll pass it along to the team.

confirming it is not currently possible.

A better approch might be to enable Google analytics on GitHub as proposed at: https://github.com/isaacs/github/issues/446

3
5

This can be done using the official GitHub traffic API.

Solutions have been implemented in github-traffic-stats (exports to csv, views only) and GitHubTelemetryParsor (SQL MS Visual Studio project).

2
  • Is this question or answer?
    – serenesat
    Feb 24 '17 at 18:20
  • 1
    an answer: by pulling the stats regularly with the stated github-projects you can collect it regularly (e.g. via crontab) and therefore have a history longer than 14days
    – hirsch
    Feb 25 '17 at 18:40
2

I made a web app to record repo traffic, clones, referrers and other analytics data. Welcome to try it out

enter image description here

1
  • Error 502 Bad gateway when I try to login. Sep 21 '21 at 23:32
1

Tracking pixels can do the trick, but you cannot filter out spam requests and cannot count unique visitors count. The only way - daily download and aggregate repository traffic data. It's not that hard, but have some edge cases.

I've made a public service Ÿ HŸPE which could do that job for you. It aggregates repository traffic, clones, referrers & stars, user profile views & followages.

Y HYPE GitHub Traffic Page

1

I have built https://github.com/jgehrcke/github-repo-stats. Every day, it generates a nice HTML and PDF report and from my point of view the most important part is that the data stays in GitHub. You don't need a cloud service to integrate this with. No S3 or so.

This is an all-in-GitHub solution, triggered to act periodically (once per day) via GitHub actions.

The time series data is simply stored in a "data repository" (where you run this action in), with transparent evolution of history.

The HTML report can be exposed via GitHub Pages. A demo is linked in the README of https://github.com/jgehrcke/github-repo-stats.

An example screenshot:

enter image description here

0

Here's also an automated solution that uses Azure LogicApps to pull the data from the GitHub API and store it in table storage.

https://github.com/matthansen0/logicapp-githubstats

0

I wrote a couple of bash scripts that use GitHub traffic API. One very simple shell script uses crontab to schedule the download of GitHub traffic statistics in plain text from your GitHub repositories. Another shell script prints the text lines to add to crontab and sets up the directories for GitHub traffic statistics. It takes minutes to setup but weeks to get enough data. At this point you can process the data with any tools you wish. I created a third script that parses the GitHub traffic and creates two markdown tables (clone, views).

It solves my challenge. It may help you.

https://github.com/BradleyA/Linux-admin/tree/master/github-repository-traffic#github-repository-traffic

0

Answered here:

https://stackoverflow.com/questions/4338358/github-can-i-see-the-number-of-downloads-for-a-repo/70047423#70047423


Port into GitHub composite action to reuse workflow code base.

https://github.com/andry81/github-accum-stats

With additional features:

  1. Can count traffic clones or/and views.
  2. Can use GitHub composite action to reuse workflow code base: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action

GitHub workflow file example:

.github/workflows/accum-gh-clone-stats.yml

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.