I wanted to setup google analytics for my octopress blog hosted on github pages. My situation was a little different than some of the existing tutorials because I’m using a custom domain, not the standard username.github.io domain. To get everything setup and working I did the following:

  1. Create a Google Analytics account.
  2. Tell your analytics account to monitor your custom domain. For me this was my www.mattnedrich.com domain, not the mattnedrich.github.io one.
  3. Update your Octopress _config.yml file to include your analytics tracking id by setting the google_analytics_tracking_id: property. This tracking id will look something like UA-23414877-5
  4. Generate and deploy your site

There are several posts online that talk about modifying the google_analytics.html octopress file. If you are using a custom domain with your github page you don’t have to do this (or at least I didn’t have to).