Rails plugin to add web statistics and analysis to your application
Ruby JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 19 commits ahead, 7 commits behind lmanolov:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Rail_Stat - Website stat tracking from within your rails app!

Updated to work with Rails 2.2.2, this plugin allows you to view stats about your website from within your app.
Instead of just relying on Google Analytics or StatCounter, track your own app stats.

Features include:
Hits - Today and last 7 days
OS platform and Browser
Country identifiers
Supported Environments, like Flash, Java etc.
Screen Resolution.

== Installation Instructions ==

It is assumed that you have already generated your rails app and have setup github as a repository for your plugin (use their wiki if you haven't, but you should).
These steps apply for either a new or existing app.

Step One: Install the Plugins
1. There are two plugins to install from github:

script/plugin install git://github.com/lazyatom/engines.git
script/plugin install git://github.com/nerbie69/railstat.git

Step Two: Generate rail_stat
1. After installing the plugin, run the following command:

script/generate rail_stat

Your app has now been populated with the generated db code and your public directory contains images for use with rail_stat code.

2. Set up Rails engines using this line of code in config/environment.rb, just below the rails boot call.

#this line exists
#require File.join(File.dirname(__FILE__), 'boot')
#Add right below the above line
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')

Step Three: Database Migration

1. Create the database schema using rake db:migrate

2. Download the IP-to-Country database from http://ip-to-country.webhosting.info/ :

   wget http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip
   unzip ip-to-country.csv.zip
For MAC OS/X Users: instead of getting wget onto your system, just download the file using Safari.

3. Copy ip-to-country.csv into db/ directory

4. Upload the data using ip-to-country.mysql.sql:

   mysql -u _user_ _dbname_ < ip-to-country.mysql.sql

5. Add your web site name to the very bottom of config/environment.rb (assign it to a constant SITE_NAME)
   SITE_NAME = 'www.mydomain.com'

Notes: Steps 2 - 4 are optional. If you don't want to download ip-to-country database 
       the system will work but the visitor country will not be tracked.

== Changes ==
v 0.1 - now rails engines is required and removed much of the generator code to function as follows:
|-- app
|   |-- controllers
|   |-- helpers
|   |-- models
|   |-- views
|-- lib
    |-- path_tracker.rb
* 	Access control to secure rail_stat for admin only viewing (uncomment in rail_stat_controller.rb).