Skip to content

Instantly share code, notes, and snippets.

@talsafran
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talsafran/38dc0d4d4527dcdea53e to your computer and use it in GitHub Desktop.
Save talsafran/38dc0d4d4527dcdea53e to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
after_action :track_event
private
def track_event
mixpanel.track(event_user, event_name)
end
def event_user
current_user.try(:id).to_s
end
def event_name
controller_action = "#{params[:controller]}##{params[:action]}"
EVENT_TRANSLATIONS[controller_action] || controller_action
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment