Something I didn't know about, and was excited to find out yesterday.

Github finally has traffic analytics built-in! (Well, finally as in this past January. But still, I didn't realize!) And all thanks to Ilya Grigorik and his excellent ga-beacon repo.

See, for the longest time, if you had a Github repository, you could only get a sense of how many times your code has been forked, or how many people "starred" it or were watching it. But to answer a question as simple as "How many page views did my repository get?", you had to arrange your own tracking.

Since you couldn't put your own Javascript snippets into a README file, using Google Analytics was right out. So the only other recourse was to use a "beacon" image (this is how email views are tracked, also, by the way). If you included an image (usually a clear 1x1 pixel image) that lived on a server you controlled, you could track how many times the image was requested, and so you could track page views (and the usual analytics stats).

Ilya took the next step, with the ga-beacon repo. He used the beacon image idea, and hooked it up to Google Analytics, so you could get all those nice graphs and tracking for free.

Once the repository became popular enough, it sounds like Github decided to just include this functionality natively. (So, if you own the repo, go to its Graphs > Traffic, to see the page views and visits).

Though you can still use his code, since Google Analytics provides more info and better graphs than the simple reporting included in Github.

So, this made me happy for two reasons:

  1. Github has native pageview analytics now!

  2. If your favorite site is lacking features, sometimes you can embarrass it into supporting them by coding them yourself, and having your code become sufficiently widespread.