Google Analytics is used by the vast majority of the internet to monitor and gauge traffic. You can quickly and easily add Google Analytics to your Rails application, however there are a few things you should pay attention to. First, make sure that the Analytics code only loads up in a production environment. It's best to do this by first creating a partial called
google_analytics and placing the following code inside of it:
This code will tell Rails to only include the Analytics code in a production environment.
Another good idea is to make sure the people in your company isn't counted in Analytics. To do this you need to obtain a list of the IP addresses that your company uses from your system administrator. Once you have that list, go to the Admin section in Analytics and Click 'All Filters' under the Account section on the left, Click New Filter, Choose 'Traffic from the ip addresses' from the drop down, and enter the ip address you wish to exclude. Repeat this for each ip address your company has. This will filter out your company's traffic and only show you the actual visitors that visit your site.