Sha256: 0c775d11ffb6c12eabb0f074c15540c2de81d1ea59719958ae2d744f9c9ae4d1

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

== What is Mixpanel (the service) ?

Mixpanel is a real-time analytics service that helps companies understand how users interact with web applications.
http://mixpanel.com

== What does this Gem do?

* Track events with properties directly from your backend.
* Track events with properties through javascript using a rack middleware.


== How to install?

  gem install mixpanel


== How to use it with a Rails application?

In your environment config file add this.

  Rails::Initializer.run do |config|

    config.middleware.use "MixpanelMiddleware", "YOUR_MIXPANEL_API_TOKEN"

If you want to use the asynchronous version of Mixpanel's javascript API

  Rails::Initializer.run do |config|

    config.middleware.use "MixpanelMiddleware", "YOUR_MIXPANEL_API_TOKEN", :async => true

In your application_controller class add a method to instance mixpanel.

  before_filter :initialize_mixpanel

  def initialize_mixpanel
    @mixpanel = Mixpanel.new("YOUR_MIXPANEL_API_TOKEN", request.env)
  end

Then in each request you want to track some event you can use:

To track events directly from your backend...

  @mixpanel.track_event("Sign in", {:some => "property"})

To track events after response with javascript...

  @mixpanel.append_event("Sign in", {:some => "property"})

To execute any javascript API call

  @mixpanel.append_api("register", {:some => "property"})
  @mixpanel.append_api("identify", "Unique Identifier")


== Notes

It is strongly recommended to call Mixpanel#track_event using an async lib
like delayed job or similar, otherwise you will delay your server responses
with mixpanel responses.

== Collaborators and Maintainers

* {Alvaro Gil}[https://github.com/zevarito] (Author)
* {Nathan Baxter}[https://github.com/LogicWolfe]
* {Jake Mallory}[https://github.com/tinomen]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mixpanel-0.7.0 README.rdoc