https://github.com/hellostealth/stealth-mixpanel
Stealth Mixpanel integration with built-in tracking
https://github.com/hellostealth/stealth-mixpanel
analytics chatbot metrics mixpanel stealth
Last synced: 3 months ago
JSON representation
Stealth Mixpanel integration with built-in tracking
- Host: GitHub
- URL: https://github.com/hellostealth/stealth-mixpanel
- Owner: hellostealth
- Created: 2018-03-27T17:39:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-01T22:57:02.000Z (over 5 years ago)
- Last Synced: 2025-03-08T03:18:05.536Z (3 months ago)
- Topics: analytics, chatbot, metrics, mixpanel, stealth
- Language: Ruby
- Size: 23.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stealth Mixpanel
This gem provides out-of-the-box tracking of state transitions inside of [Stealth](https://github.com/hellostealth/stealth) via the [Mixpanel](https://mixpanel.com) service. You are free to track additional events as needed, and we may add more baseline events in the future.
[](https://badge.fury.io/rb/stealth-mixpanel)
## Setup
Once you have your Mixpanel Project Token, set the `MIXPANEL_PROJECT_TOKEN` environment variable. That's the only setup required!
## Events Tracked
Here are the events that are tracked automatically:
* `State Change`: these are sent to Mixpanel each time a state transition takes place. The user's `recipient_id` is sent to Mixpanel as the `distinct_id`. Additional properties for `flow` and `state` are also sent with the event. Please note that when an `update_session_to` is called, the user's session is updated immediately and therefore an event is also sent to Mixpanel.
## Tracking Custom Events
If you'd like to track custom events or store user profiles, you can use the following:
```ruby
tracker = Stealth::Mixpanel.new
# Track events
tracker.track(current_session_id, 'event-to-track')
# Store/update user profiles
tracker.people.set(current_session_id, { offer_code: '1234-2', happy: 'yes' })
```For more information about tracking custom events or user profiles, please check out the [mixpanel-ruby](https://github.com/mixpanel/mixpanel-ruby) gem. The `tracker` instance above is just a `Mixpanel::Tracker` object.