We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
This is a work around to avoid track events on certain environments, like tests or development.
if ["production"].include?(Rails.env) MIXPANEL_TOKEN = "your_token_here" YourApplication::Application.config.middleware.use "Mixpanel::Tracker::Middleware", MIXPANEL_TOKEN else class DummyMixpanel def method_missing(m, *args, &block) true end end end
before_filter :initialize_mixpanel def initialize_mixpanel if defined?(MIXPANEL_TOKEN) @mixpanel = Mixpanel.new(MIXPANEL_TOKEN, request.env) else @mixpanel = DummyMixpanel.new end end