Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mixpanel-rails

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mixpanel-rails

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Mixpanel::Rails

Painlessly integrate your rails application with Mixpanel

Installation

Add this line to your application's Gemfile:

gem 'mixpanel-rails'

Configuration

Set the config.mixpanel.api_token parameter in your applications configuration or the MIXPANEL_API_TOKEN environment variable. e.g.

# config/environments/staging.rb
config.mixpanel.token = 'XYZ'
config.mixpanel.options = {:async => true}

Want to use the middleware for tracking with JavaScript?

# config/application.rb
config.mixpanel.middleware.use = true
config.mixpanel.middleware.persist = false
config.mixpanel.middlware.insert_js_last = true
config.mixpanel.middleware.config = {:cookie_name => 'mixpanel_cookie' }

Usage

You can now access a pre-configured instance of Mixpanel::Tracker from anywhere in your application by including the Mixpanel::Helper module:

class User < ActiveRecord::Base
  include Mixpanel::Helper
  after_create :notify_mixpanel

  def notify_mixpanel
    mixpanel.track 'User Created', :distinct_id => self.id
  end
end

Alternatively, you can use Rails.application.mixpanel if you don't want to include the module

FAQs

Package last updated on 29 May 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc