www.SmarteGuru.com
  Home | Blogs | Recipe | Find a Friend | Discussion Board | Resources | Developers Area | Articles | Health |  Login | Register Now 

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

Social Bookmarks: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Webnews
  • Y!GG
  • Google Bookmarks
  • SEOigg
  • YahooMyWeb
  • Live-MSN
  • DZone
  • Facebook
  • Technorati
  • Ask
  • Furl
  • Spurl
  • Webbrille

Related Posts

Tags: , , , , ,

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Viewed: 61 views

Leave a Reply

Twitter Users!
Enter your personal information in the form or sign in with your Twitter account by clicking the button below.

Home - About Us - Help - Terms and Conditions - Site Map - Link to Us - Resources - Contact Us
Google Rank Calculator | Suggest developer resource | Suggest Article
All rights reserved © 2007 SmarteGuru.com.