Permalink
Browse files

additional session tracking helpers

  • Loading branch information...
1 parent 3727f46 commit aaa09d9dacea1758cef7602236ed303d20028431 @jacquescrocker committed Jun 12, 2011
Showing with 14 additions and 2 deletions.
  1. +1 −1 lib/aarrr/middleware.rb
  2. +13 −1 lib/aarrr/session.rb
View
2 lib/aarrr/middleware.rb
@@ -11,7 +11,7 @@ def call(env)
aarrr_session = AARRR(env)
status, headers, body = @app.call(env)
- # require 'ruby-debug';debugger
+
# sets a tracking cookie on the response
response = Rack::Response.new body, status, headers
aarrr_session.set_cookie(response)
View
14 lib/aarrr/session.rb
@@ -83,19 +83,31 @@ def acquisition!(event_name, options = {})
options[:event_type] = :acquisition
track!(event_name, options)
end
+ alias :acq! :acquisition!
def activation!(event_name, options = {})
options[:event_type] = :activation
track!(event_name, options)
end
+ alias :act! :activation!
def retention!(event_name, options = {})
options[:event_type] = :retention
track!(event_name, options)
end
+ alias :ret! :retention!
- # TODO: referral and revenue
+ def referral!(event_name, options = {})
+ options[:event_type] = :referral
+ track!(event_name, options)
+ end
+ alias :ref! :referral!
+ def revenue!(event_name, options = {})
+ options[:event_type] = :revenue
+ track!(event_name, options)
+ end
+ alias :rev! :revenue!
protected

0 comments on commit aaa09d9

Please sign in to comment.