Skip to content

Instantly share code, notes, and snippets.

@henryalee
Created August 13, 2012 23:40
Show Gist options
  • Save henryalee/3344870 to your computer and use it in GitHub Desktop.
Save henryalee/3344870 to your computer and use it in GitHub Desktop.
partial progress on mixpanel tracking
diff --git a/app/controllers/api/stores/sessions_controller.rb b/app/controllers/api/stores/sessions_controller.rb
index e87ce01..34c0f62 100644
--- a/app/controllers/api/stores/sessions_controller.rb
+++ b/app/controllers/api/stores/sessions_controller.rb
@@ -5,6 +5,7 @@ module Api
include Devise::Controllers::InternalHelpers
before_filter :ensure_params_exist
+ after_filter :mixpanel_track, :only => [:create]
respond_to :json
@@ -49,6 +50,11 @@ module Api
warden.custom_failure!
render :json=> {success: false, message: "Error with your login or password"}, :status => 401
end
+
+ def mixpanel_track
+ logger.info "-"*100
+ # logger.info "mixpanel.track('Sign In', "
+ end
end
end
end
diff --git a/app/controllers/api/users/registrations_controller.rb b/app/controllers/api/users/registrations_controller.rb
index 0cd80e9..8cf2042 100644
--- a/app/controllers/api/users/registrations_controller.rb
+++ b/app/controllers/api/users/registrations_controller.rb
@@ -2,6 +2,8 @@ module Api
module Users
class RegistrationsController < Devise::RegistrationsController
include OrdersHelper
+
+ after_filter :mixpanel_tracking
# POST /resource
def create
@@ -91,6 +93,12 @@ module Api
end
end
+
+ protected
+ def mixpanel_tracking
+ logger.info "-"*100
+ @mixpanel.track("Sign Up", {})
+ end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment