Saw¶ ↑
<img src=“https://secure.travis-ci.org/amolpujari/saw.png?branch=master” /> <img src=“https://codeclimate.com/badge.png” /> <img src=“https://gemnasium.com/amolpujari/saw.png” />
As a developer/admin, I saw user coming to registration page, with parameters. I saw user clking on “Connect”.
‘What the user might have done?` this is a common question developers do have while debugging any issue, going through the logs checking for particular log statement or request param, and then after spending an hour coming with a decision that user must have done this. Saw saves this hour, time spent on debugging and answering this question `What user might have done?`.
This is one more simply way to track what user is doing.
Installation¶ ↑
Add this line to your application’s Gemfile:
gem 'saw'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install saw
And then install
$ rails generate saw install
Next
$ rake db:migrate
Usage¶ ↑
before_filter :saw
Or
saw 'visiting details page', { :extra => 'something' }
Or
= in views <button id="button-retry" onclick="open_pop_up_form();" class="mybutton medium green"> Connect to your Device </button> <script type="text/javascript"> function open_pop_up_form(){ $.post("/visits", { doing: "clicked on 'Connect to your Device' " } ); ....
Access users’ visits as
visit = @user.visits.sample visit.user_agent visit.remote_host visit.hits.map(&:note) visit.lasts = => 00:12:45 visit.title = => 00:12:45 on Apr 14, 2013 visit.summary hit = visit.hits.sample hit.note hit.url hit.http_method hit.action hit.json_data hit.created_at
A visit is not a single request made to the server but a session. Similalry a hit is not necessary to be a request hit.