pydelion.com

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.

Exit mobile version