Installation
Get up and running in under 10 minutes! …I hope?
Add to your Gemfile
:
gem "i_wonder"
and install:
bundle install
Generate the migration files and migrate your database:
rake i_wonder:install:migrations rake db:migrate
Add the engine to your routes. This is where the dashboard will be hosted
Rails.application.routes.draw do ... mount IWonder::Engine => "/super_analytics_engine" end
This gem hooks into the “rake cron
” request. It can’t take snapshots of your metrics any faster than this cron is run. We recommend every hour. This will be run automatically if you are hosted on Heroku and have the ‘hourly cron’ add-on enabled.
This Gem requires the Delayed::Job gem. Installation and configuration instructions can be found at github.com/tobi/delayed_job.
We also require the highcharts javascript file in your applications asset path. We don’t include it because of licencing reasons. It’s free for testing and development. You can find it at www.highcharts.com/
IWonder’s controllers will run any :before_filters
you have set in your application controller. You can easily check for a password or admin status there.
You can choose to navigate directly to the dashboard. If you want to include a link on your admin page to the i_wonder dashboard, your can access the url with i_wonder.root_url
such as:
<%= link_to "Go to analytics >", i_wonder.root_url %>
If you want to configure this gem, add this to an initializer.
IWonder.configure do |c| c.controllers_to_ignore = [] # These are all the controllers which don't log any events (i_wonder is also ignored) c.only_log_hits_on_200 = true # By default hits and new visitors won't be logged on anything but a 200 or 304 (not modified). Your custom events will still be recorded. c.back_to_app_link = "/" # this is the link hitting the home button in IWonder will take you to. c.app_name = "My App" c.return_visit_interval = 1.hour # how long between hits generates a return_visit event end
This gem will track the visitor with a permanent cookie (will remember them next visit). However, it can also track users and accounts. Simply call one or both of these methods anywhere in the controller.
i_wonder_for_user_id(user_id)
or
i_wonder_for_account_id(account_id)