Added note about event
Andrew Kane
committed Jun 18, 2014
commit 20083687d3606b32a03a9f971402ad5aa4168929
Showing 3
changed files with
21 additions
and 3 deletions
README.md
+17
-0
| @@ | @@ -488,6 +488,23 @@ class Ahoy::Store < Ahoy::Stores::ActiveRecordTokenStore |
| end | |
| ``` | |
| + | #### Authentication |
| + | |
| + | Ahoy no longer tracks the `$authenticate` event automatically. |
| + | |
| + | To restore this behavior, use: |
| + | |
| + | ```ruby |
| + | class Ahoy::Store < Ahoy::Stores::ActiveRecordTokenStore |
| + | |
| + | def authenticate(user) |
| + | super |
| + | ahoy.track "$authenticate" |
| + | end |
| + | |
| + | end |
| + | ``` |
| + | |
| #### Global Options | |
| Replace the `Ahoy.user_method` with `user` method, and replace `Ahoy.track_bots` and `Ahoy.exclude_method` with `exclude?` method. | |
ahoy/stores/base_store.rb b/lib/ahoy/stores/base_store.rb
+2
-1
| @@ | @@ -16,6 +16,7 @@ module Ahoy |
| end | |
| def authenticate(user) | |
| + | @user = user |
| if visit and visit.respond_to?(:user) and !visit.user | |
| visit.user = user | |
| visit.save! | |
| @@ | @@ -26,7 +27,7 @@ module Ahoy |
| end | |
| def user | |
| - | controller.current_user |
| + | @user ||= controller.current_user |
| end | |
| def exclude? | |
vendor/assets/javascripts/ahoy.js
+2
-2
| @@ | @@ -164,8 +164,8 @@ |
| } | |
| var data = { | |
| - | visit_id: visitId, |
| - | visitor_id: visitorId, |
| + | visit_token: visitId, |
| + | visitor_token: visitorId, |
| platform: ahoy.platform || "Web", | |
| landing_page: window.location.href, | |
| screen_width: window.screen.width, | |