Quick post today on how to add Google Analytics tracking to your GitHub pages site. First, head over to Google Analytics and sign up. After entering your details and green lighting the T&C’s you’ll be directed to an admin page. This will give you the tracking code that you need to add to each page of your site. Mine, anonymised, is below:
Jekyll makes adding this easy; create a HTML file in your _includes folder containing this code. I named mine google_analytics.html. Then add the following to your default layout,
Within a few hours Google Analytics should pick up the change, and you’ll be capturing session times, demographics, and other useful information on visitors to your site.
Thanks to Joshua Lande for his original post.
Subscribe via RSS