25 Feb

Adding Google Analytics to Sinatra application

To add Google Analytics code to Sinatra application there’s a need to install gem rack-google-analytics.

gem install rack-google-analytics

Add this to your app.rb:

require 'rack-google-analytics'
use Rack::GoogleAnalytics, :tracker => 'UA-XXXXXXXX-X'

And restart the app.

Leave a Reply

Your email address will not be published. Required fields are marked *