Skip to content

Disable tracking for specific url

bluenaute edited this page Nov 26, 2012 · 2 revisions

Put this in your application controller:

  before_filter :initialize_mixpanel

  def initialize_mixpanel
    if request.path.include?("admin")
      #skip for admin
      request.env["HTTP_SKIP_MIXPANEL_MIDDLEWARE"]="true"
    else
      @mixpanel ||= Mixpanel::Tracker.new(MIXPANEL_TOKEN, {:env=>request.env,:persist => true})
    end
  end