unofficial Google Analytics tracking for GitHub repositories using Azure Functions
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Software License PRs Welcome

Unofficial Google Analytics tracking for GitHub projects

This is an unofficial Google Analytics for GitHub repositories tracking using Azure Functions and written in Node.js. You can use this to track pageviews in all pages that contain Markdown, like READMEs, wikis etc.

Motivation

GitHub has a mechanism by which you can see tracking information about your repositories, you can read about it here. However, it hosts data only for the last 14 days and there is no real time information.

Attention

GitHub uses camo to cache and serve images (details), so (a) tracking may not be accurate and (b) user details are hidden (IP, referer, etc.).

Instructions

  1. Click here to visit Google Analytics and create a new account
  2. When you are done, copy your Tracking ID (should be in the format UA-XXXX-Y)
  3. Click the button below to deploy the project in your Azure subscription

  1. When the deployment is completed, copy your Functions URL (should be something like https://yourfunctionname.azurewebsites.net)
  2. Edit your README files in your repos that you want to track (or any files that contain markdown) and insert the necessary code.

First, change YYYYYY to your Azure Function's URL. Then, change XXXXXXXX to a distinctive name to use in order to track this specific page. Might be the name of your repo or whatever you like. If you want to display a button use this code:

[![unofficial Google Analytics for GitHub](https://YYYYYY.azurewebsites.net/api?repo=XXXXXXXX)](https://github.com/dgkanatsios/gaforgithub)

If you do not want to display the button, use this code:

![](https://YYYYYY.azurewebsites.net/api?repo=XXXXXXXX&empty)

Cost

The deployment uses Azure Functions' Consumption Plan so you'll see that it's really cheap to host it for your projects.

Inspiration

Inspired by igrorik's solution here that works with Go language and Google App Engine.