README.md in ahoy_events-0.0.1 vs README.md in ahoy_events-0.0.2

- old
+ new

@@ -1,9 +1,17 @@ # Ahoy Events :seedling: Simple, powerful event tracking for Rails +Track events in: + +- JavaScript +- Ruby +- Native apps + +And store them wherever you’d like - your database, logs, external services, or all of them. + ## Installation First, [add Ahoy](https://github.com/ankane/ahoy#installation). Next, add this line to your application’s Gemfile: @@ -56,10 +64,11 @@ Create an `Ahoy::Event` model to store events. ```sh rails generate ahoy_events:active_record +rake db:migrate ``` ### Custom Create your own subscribers in `config/initializers/ahoy.rb`. @@ -85,13 +94,34 @@ Ahoy.subscribers << LogSubscriber.new ``` Add as many subscribers as you’d like. +## Reference + +Track all Rails actions + +```ruby +class ApplicationController < ActionController::Base + after_filter :track_action + + protected + + def track_action + ahoy.track "Hit action", request.filtered_parameters + end +end +``` + +Use a different model [master] + +```ruby +Ahoy.subscribers << Ahoy::Subscribers::ActiveRecord.new(model: Event) +``` + ## TODO - Ability to track JavaScript events automatically (button clicks, etc) -- Ability to track Rails events automatically (actions, etc) ## Contributing Everyone is encouraged to help improve this project. Here are a few ways you can help: