You will need Sija's version of the garb gem, so add this line to your Gemfile
(you will need git installed for this):
gem 'garb', :git => 'git://github.com/Sija/garb.git'
Then run the gem bundler: bundle install
Set your google username
username = ''
Put in your google password (create a secondary account for this with a really long randomly generated password)
password = ''
Get an api key for google analytics from here: https://code.google.com/apis/console and set the api_key:
api_key = ''
pick your property from the google analytics interface ( http://google.com/analytics ) and set it:
ua = ''
Then add the contents of google_pageviews.erb
to your layout file.
If you change the dimensions from :month
make sure you update the data-moreinfo
line so that it matches the interval.
I agree @davefp but the OAuth sessions with Google are overly complicated