Mixpanel

Integrate in-app subscription events from RevenueCat with Mixpanel

👍

The Mixpanel integration is available on the Pro plan.

RevenueCat can automatically send subscription events into Mixpanel. This is useful for seeing all events and revenue that occur for your app even if it's not active for a period of time.

Events

The Mixpanel integration tracks the following events:

Event

Description

Initial Purchase

The first purchase of an auto-renewing subscription product that does not contain a free trial.

Trial Started

The start of an auto-renewing subscription product free trial.

Trial Converted

When an auto-renewing subscription product converts from a free trial to normal paid period.

Trial Cancelled

When a user turns off renewals for an auto-renewing subscription product during a free trial period.

Renewal

When an auto-renewing subscription product renews OR a user repurchases the auto-renewing subscription product after a lapse in their subscription.

Cancellation

When a user turns off renewals for an auto-renewing subscription product during the normal paid period.

Uncancellation

When a user re-enables the auto-renew status for a subscription.

Non Subscription Purchase

The purchase of any product that's not an auto-renewing subscription.

Subscription paused

A subscription has been paused.

Expiration

A subscription has expired and access should be removed.

Billing Issues

There has been a problem trying to charge the subscriber.

This does not mean the subscription has expired (in the case of a grace period enabled).

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.

// Configure Purchases SDK
Purchases.configure(withAPIKey: "public_sdk_key", appUserID: "my_app_user_id")

// Set App User Id in Mixpanel
Mixpanel.mainInstance().identify(distinctId: "my_app_user_id")
// 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 to have the same user identity, you can "turn on" the integration and configure the event names from the RevenueCat dashboard.

  1. Navigate to your project in the RevenueCat dashboard and find the Integrations card in the left menu. Select + New
  1. Choose Mixpanel from the Integrations menu
  2. Add your Mixpanel token
  3. Enter the event names that RevenueCat will send or choose the default event names
  4. Select whether you want RevenueCat to report proceeds (after app store cut) or revenue (gross sales)
Mixpanel configuration screenMixpanel configuration screen

Mixpanel configuration screen

Sample Event

Below is the sample JSON that is delivered to Mixpanel for a renewal event.

[
  {
    "$append": {
      "$transactions": {
        "$amount": 9.99,
        "$time": "2019-07-26T20:48:56",
        "product_id": "your_product_id",
        "store": "PLAY_STORE"
      }
    },
    "$distinct_id": "myCustomAppUserId",
    "$token": "abcdefghijklmnopqrstuvwxyz"
  },
  {
    "$add": {
      "Total Tracked Revenue": 9.99
    },
    "$distinct_id": "myCustomAppUserId",
    "$token": "abcdefghijklmnopqrstuvwxyz"
  }
]
{
  "event": "Renewal Event",
  "properties": {
    "$insert_id": "23456789",
    "distinct_id": "myCustomAppUserId",
    "product_id": "your_product_id",
    "revenue": 9.99,
    "store": "PLAY_STORE",
    "subscriber_attributes": {},
    "time": 1581674623,
    "token": "123456789abcdefghijk"
  }
}

Did this page help you?