Sha256: 35bc233cd6a707f85e270f15092e4d7ad7062a5020fb904e4ac9e4a6bfa38530
Contents?: true
Size: 1.19 KB
Versions: 12
Compression:
Stored size: 1.19 KB
Contents
== Google Analytics for Rails Complete package to use google analytics in your rails application. It supports recording to google analytics: * for normal web browsers (javascript) * for mobile handsets (gif) * programmatically (events) == Installation Add to your Gemfile: gem 'garails' and run 'bundle install'. Then create a config/initializers/garails.rb with the following content: Garails.ga_account = 'UA-12345678-9' # Garails.ga_cookie_domain = '.mydomain.com' # Garails.ga_hostname = 'www.mydomain.com' == Usage === for normal web browsers Add to your layout (usually app/views/layouts/application.html.erb) in the head section: <html> <head> <title>My App</title> ... <%= google_analytics_tracking_javascript %> </head> <body> ... === for mobile handsets (non-Javascript) In your layout for mobile handsets without Javascript support, add at the very bottom of the body the following: <%= utm_tag %> === programmatically In your view or controller you can record events by using: ga_event(category, action, label, value) See http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html for details. label and value are optional.
Version data entries
12 entries across 12 versions & 1 rubygems