Installation Guide
- Create the database schema in the same database as the main application using rake db:migrate
- 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
- Upload the data in the database:
For MySQL: ---------- Copy ip-to-country.csv in db/ directory mysql -u _user_ _dbname_ < ip-to-country.mysql.sql
For PostgreSQL: --------------- Assuming that the user puts the CSV file in their C root the following command should be executed from a psql prompt: COPY iptocs(ip_from, ip_to, country_code2, country_code3, country_name) FROM 'C:\\ip-to-country.csv' WITH CSV;
- Add your web site name at the end of config/environment.rb (assign it to a constant SITE_NAME). Example:
SITE_NAME = 'www.mydomain.com'
- Add the following code at the end of your layouts (just before the closing </body> tag):
<script type="text/javascript" src="/rail_stat/tracker_js"></script> <noscript> <img src="/rail_stat/track" width="1" height="1" alt="" style="position: absolute;" /> </noscript>
- The statistics are available on location /rail_stat
Notes: Steps 2 and 3 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.