Integrate Google Analytics Plugin in your application
This plugin will automatically add Google Analytics code to all of your pages, instead of manually having to add it to app/views/application.rhtml. You put your tracker id in config/environment.rb and it Just Works. It will, by default, only work in production mode, and you can switch it off for particular controllers and actions.
To install it, add plugin repository to your rails plugin sources:
script/plugin source http://svn.rubaidh.com/plugins/trunk
and to install the Google Analytics plugin:
script/plugin install google_analytics
To configure it, add the following to config/environment.rb:
Rubaidh::GoogleAnalytics.tracker_id = 'UA-12345-67'
where the tracker_id is what _uacct gets set to in the chunk of javascript that Google gives you to insert. That’s it! All configured! Your tracking information will be inserted into every page. If you don’t want it in particular controller, you can do the usual to skip after_filters:
skip_after_filter :add_google_analytics_code
Related Posts
Tags: Google Analytics Plugin, google_analytics_code, integrate google analytics, ror plugin, ror plugin for google analytics, ruby on rails plugin
Viewed: 61 views

















