Mixpanel
Integrate in-app subscription events from RevenueCat with Mixpanel
The Mixpanel integration is available to all users signed up after September '23, the legacy Grow and Pro plans, and Enterprise plans. If you're on a legacy Free or Starter plan and want to access this integration, migrate to our new pricing via your billing settings.
Mixpanel can be a useful integration tool for seeing all events and revenue that occur for your app even if it’s not active for a period of time. You can use Mixpanel’s array of product analytical tools to help get new customers, and engage and retain old customers.
With our Mixpanel integration, you can:
- Formulate a data model using interactions between a user and your product.
- Use interactive reports to understand when a user converts and why.
With accurate and up-to-date subscription data in Mixpanel, you'll be set to turbocharge your product analytics ⚡️
Integration at a Glance
Includes Revenue | Supports Negative Revenue | Sends Sandbox Events | Includes Subscriber Attributes | Sends Transfer Events | Optional Event Types |
---|---|---|---|---|---|
✅ | ✅ | Requires Token | ✅ | ❌ | non_subscription_purchase_event uncancellation_event subscription_paused_event expiration_event billing_issue_event product_change_event |
Events
The Mixpanel integration tracks the following events:
Event | Default Event Name | Description | App Store | Play Store | Amazon | Stripe | Promo |
---|---|---|---|---|---|---|---|
Initial Purchase | rc_initial_purchase_event | A new subscription has been purchased. | ✅ | ✅ | ✅ | ✅ | ❌ |
Trial Started | rc_trial_started_event | The start of an auto-renewing subscription product free trial. | ✅ | ✅ | ✅ | ✅ | ❌ |
Trial Converted | rc_trial_converted_event | When an auto-renewing subscription product converts from a free trial to normal paid period. | ✅ | ✅ | ✅ | ✅ | ❌ |
Trial Cancelled | rc_trial_cancelled_event | When a user turns off renewals for an auto-renewing subscription product during a free trial period. | ✅ | ✅ | ✅ | ✅ | ❌ |
Renewal | rc_renewal_event | An existing subscription has been renewed or a lapsed user has resubscribed. | ✅ | ✅ | ✅ | ✅ | ❌ |
Cancellation | rc_cancellation_event | A subscription or non-renewing purchase has been cancelled. See cancellation reasons for more details. | ✅ | ✅ | ✅ | ✅ | ✅ |
Uncancellation | rc_uncancellation_event | A non-expired cancelled subscription has been re-enabled. | ✅ | ✅ | ✅ | ❌ | ❌ |
Non Subscription Purchase | rc_non_subscription_purchase_event | A customer has made a purchase that will not auto-renew. | ✅ | ✅ | ✅ | ✅ | ✅ |
Subscription paused | rc_subscription_paused_event | A subscription has been paused. | ❌ | ✅ | ❌ | ❌ | ❌ |
Expiration | rc_expiration_event | A subscription has expired and access should be removed. If you have Platform Server Notifications configured, this event will occur as soon as we are notified (within seconds to minutes) of the expiration. If you do not have notifications configured, delays may be approximately 1 hour. | ✅ | ✅ | ✅ | ✅ | ✅ |
Billing Issues | rc_billing_issue_event | There has been a problem trying to charge the subscriber. This does not mean the subscription has expired. Can be safely ignored if listening to CANCELLATION event + cancel_reason=BILLING_ERROR. | ✅ | ✅ | ✅ | ✅ | ❌ |
Product Change | rc_product_change_event | A subscriber has changed the product of their subscription. This does not mean the new subscription is in effect immediately. See Managing Subscriptions for more details on updates, downgrades, and crossgrades. | ✅ | ✅ | ❌ | ✅ | ❌ |
For events that have revenue, such as trial conversions and renewals, RevenueCat will automatically record this amount along with the event in Mixpanel.
Setup
1. Set Mixpanel User Identity
If you're using the Mixpanel SDK, you can set the Distinct Id to match the RevenueCat App User Id. This way, events sent from the Mixpanel SDK and events sent from RevenueCat can be synced to the same user.
Use the .identify()
method on the Mixpanel SDK to set the same App User ID that is set in RevenueCat.
Custom Mixpanel Subscriber Attribute
We recommend keeping the Mixpanel SDK identifier the same as RevenueCat's App User ID as described above. Alternatively, if you want Mixpanel events tied to a different identifier, you can set a subscriber attribute for $mixpanelDistinctId
that is sent with events instead of RevenueCat's App User ID.
If a user has that subscriber attribute set it will be used instead of the RevenueCat App User ID in the Mixpanel events.
Purchases.configure(withAPIKey: "public_sdk_key", appUserID: "my_app_user_id")
// Option 1: Match Mixpanel's SDK identity to RevenueCat's App User ID
Mixpanel.mainInstance().identify(distinctId: "my_app_user_id")
// Option 2: Set different Mixpanel identifier in RevenueCat
Purchases.shared.attribution.setMixpanelDistinctID(Mixpanel.mainInstance().distinctId)
// Configure Purchases SDK
[RCPurchases configureWithAPIKey:@"public_sdk_key" appUserID:@"my_app_user_id"];
// Set App User Id in Mixpanel
[[Mixpanel sharedInstance] identify:@"my_app_user_id"];
// Configure Purchases SDK
Purchases.configure(this, "public_sdk_key", "my_app_user_id");
// Set App User Id in Mixpanel
MixpanelAPI mixpanel =
MixpanelAPI.getInstance(context, MIXPANEL_TOKEN);
mixpanel.identify("my_app_user_id");
2. Send RevenueCat Events to Mixpanel
After you've set up the Purchases SDK and Mixpanel SDK, you can "turn on" the integration and configure the event names from the RevenueCat dashboard.
- Navigate to your project in the RevenueCat dashboard and find the Integrations card in the left menu. Select + New
- Choose Mixpanel from the Integrations menu
- Add your Mixpanel Project token
- Enter the event names that RevenueCat will send or choose the default event names
- Select whether you want sales reported as gross revenue (before app store commission), or after store commission and/or estimated taxes.
Sample Events
Below are sample JSONs that are delivered to Mixpanel for events.
{
"track_event": {
"event": "rc_initial_purchase_event",
"properties": {
"distinct_id": "12345678-1234-1234-1234-123456789012",
"token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"time": 1541012230,
"revenue": 4.99,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"engage_event": {
"$append": {
"$transactions": {
"$time": 1541012230,
"$amount": 4.99,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"$token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"$distinct_id": "12345678-1234-1234-1234-123456789012"
}
}
{
"track_event": {
"event": "rc_trial_started_event",
"properties": {
"distinct_id": "12345678-1234-1234-1234-123456789012",
"token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"time": 1541011312,
"revenue": 0.0,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"engage_event": {
"$append": {
"$transactions": {
"$time": 1541011312,
"$amount": 0.0,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"$token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"$distinct_id": "12345678-1234-1234-1234-123456789012"
}
}
{
"track_event": {
"event": "rc_trial_converted_event",
"properties": {
"distinct_id": "12345678-1234-1234-1234-123456789012",
"token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"time": 1541033435,
"revenue": 44.99,
"product_id": "yearly_sub",
"store": "APP_STORE"
}
},
"engage_event": {
"$append": {
"$transactions": {
"$time": 1541033435,
"$amount": 44.99,
"product_id": "yearly_sub",
"store": "APP_STORE"
}
},
"$token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"$distinct_id": "12345678-1234-1234-1234-123456789012"
}
}
{
"track_event": {
"event": "rc_trial_cancelled_event",
"properties": {
"distinct_id": "12345678-1234-1234-1234-123456789012",
"token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"time": 1541014060,
"revenue": 0.0,
"product_id": "yearly_sub",
"store": "APP_STORE"
}
},
"engage_event": {
"$append": {
"$transactions": {
"$time": 1541014060,
"$amount": 0.0,
"product_id": "yearly_sub",
"store": "APP_STORE"
}
},
"$token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"$distinct_id": "12345678-1234-1234-1234-123456789012"
}
}
{
"track_event": {
"event": "rc_renewal_event",
"properties": {
"distinct_id": "12345678-1234-1234-1234-123456789012",
"token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"time": 1541026947,
"revenue": 4.99,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"engage_event": {
"$append": {
"$transactions": {
"$time": 1541026947,
"$amount": 4.99,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"$token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"$distinct_id": "12345678-1234-1234-1234-123456789012"
}
}
{
"track_event": {
"event": "rc_cancellation_event",
"properties": {
"distinct_id": "12345678-1234-1234-1234-123456789012",
"token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"time": 1552135741,
"revenue": 0.0,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"engage_event": {
"$append": {
"$transactions": {
"$time": "2022-12-09T12:49:01",
"$amount": 0.0,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"$token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"$distinct_id": "12345678-1234-1234-1234-123456789012"
}
}
{
"track_event": {
"event": "rc_non_subscription_purchase_event",
"properties": {
"distinct_id": "12345678-1234-1234-1234-123456789012",
"token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"time": 1559530911,
"$insert_id": "12345678",
"revenue": 4.99,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"engage_event": {
"$append": {
"$transactions": {
"$time": "2022-12-03T03:01:51",
"$amount": 4.99,
"product_id": "monthly_sub",
"store": "APP_STORE"
}
},
"$token": "abCdEFg01HiJklMN2OpQ3RStu4v5",
"$distinct_id": "12345678-1234-1234-1234-123456789012"
}
}
Subscription Status Attribute
Whenever RevenueCat sends an event to Mixpanel, we'll update the rc_subscription_status
user attribute with any applicable changes, using one of the following values:
Status | Description |
---|---|
active | The customer has an active, paid subscription which is set to renew at their next renewal date. |
intro | The customer has an active, paid subscription through a paid introductory offer. |
cancelled | The customer has a paid subscription which is set to expire at their next renewal date. |
grace_period | The customer has a paid subscription which has entered a grace period after failing to renew successfully. |
trial | The customer is in a trial period which is set to convert to paid at the end of their trial period. |
cancelled_trial | The customer is in a trial period which is set to expire at the end of their trial period. |
grace_period_trial | The customer was in a trial period and has now entered a grace period after failing to renew successfully. |
expired | The customer's subscription has expired. |
promotional | The customer has access to an entitlement through a granted RevenueCat promotional subscription. |
expired_promotional | The customer previously had access to an entitlement through a granted RevenueCat promotional subscription that has since expired. |
paused | The customer has a paid subscription which has been paused and is set to resume at some future date. |
For customers with multiple active subscriptions, this attribute will represent the status of only the subscription for which the most recent event occurred.
Please note that since this attribute is set and updated when events are delivered, subscribers with events prior to our release of this attribute (during November 2023) will not have this attribute set until/unless a future event (renewal, cancellation, etc) occurs.
Updated 7 days ago