Statsig

Integrate in-app subscription events from RevenueCat with Statsig

👍

The Statsig integration is available on the Pro plan.

RevenueCat can automatically send billing, subscription, and revenue metrics to your Statsig project. This can be helpful in optimizing purchases and revenue, and understanding which features are causing product metrics to move. For example, you might want to:

  • Compute how every new product improvement impacts your business metrics
  • Simplify setting up Feature Gates and be able to automatically A/B test new features
  • Run multiple independent experiments in parallel

Events

The Statsig integration tracks the following events:

EventDescription
Initial PurchaseThe first purchase of an auto-renewing subscription product, includes free trials.
Non Subscription PurchaseThe purchase of any product that's not an auto-renewing subscription.
RenewalWhen an auto-renewing subscription product renews OR a user repurchases the auto-renewing subscription product after a lapse in their subscription.
Product ChangeA subscriber has changed the product of their subscription.
CancellationA subscription or non-renewing purchase has been cancelled.
UncancellationWhen a user re-enables the auto-renew status for a subscription.
Billing IssuesThere 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).
Subscription pausedA subscription has been paused.
TransferA transfer of transactions and entitlements was initiated between one App User ID(s) to another.
ExpirationA subscription has expired and access should be removed.

Setup

1. Set Statsig User Identity

In order to associate RevenueCat data with Statsig feature gate and/or experiment, the RevenueCat app user ID must match the Statsig User ID. You can read more about Statsig user IDs in their documentation here. You can set up a custom app user ID in RevenueCat by following the instructions in our Identifying Users documentation.

2. Enable RevenueCat integration with Statsig

On the Statsig Integration page enable the RevenueCat integration.

676676

Enable RevenueCat in Statsig integration page

3. Send RevenueCat events into Statsig

After you enabled the RevenueCat integration in Statsig's dashboard, you can "turn on" the integration from the RevenueCat dashboard.

  1. Navigate to your project in the RevenueCat dashboard and find the Integrations card in the left menu. Select + New
332332
  1. Choose Statsig from the Integrations menu.
  2. Add your 'statsig-server-secret'

Remember to select Add Integration

952952

Statsig configuration page

Testing the Statsig integration

Enable Sandbox Events in Statsig

Ingesting sandbox events into Statsig can be enabled in the RevenueCat configuration in the Statsig Integration page.

15421542

Include Sandbox Events in Statsig integration page

Make a sandbox purchase with a new user

Simulate a new user installing your app, and go through your app flow to complete a sandbox purchase.

Check that the Statsig event delivered successfully

While still on the Customer View, select the purchase event in the Customer History page and make sure that the Statsig integration event exists and was delivered successfully.

22402240

Check Statsig dashboard for the delivered event

Navigate to your Statsig app > Metrics. You will see events RevenueCat has dispatched to Statsig under 'Log Stream'.

27622762

Sample Event

Below is a sample JSON that is delivered to Statsig for a Trial Started event.

{
  "api_version": "1.0",
  "event": {
    "aliases": [
      "yourCustomerAliasedID"
    ],
    "app_id": "yourAppID",
    "app_user_id": "yourCustomerAppUserID",
    "country_code": "US",
    "currency": "USD",
    "entitlement_ids": [
      "pro_cat"
    ],
    "environment": "SANDBOX",
    "event_timestamp_ms": 1636388733968,
    "expiration_at_ms": 1636388909000,
    "id": "UniqueIdentifierOfEvent",
    "is_family_share": false,
    "offer_code": null,
    "original_app_user_id": "OriginalAppUserID",
    "original_transaction_id": "1000000906455653",
    "period_type": "TRIAL",
    "presented_offering_id": "OfferingID",
    "price": 0,
    "price_in_purchased_currency": 0,
    "product_id": "com.revenuecat.monthly_4.99.1_week_intro",
    "purchased_at_ms": 1636388729000,
    "store": "APP_STORE",
    "subscriber_attributes": {},
    "takehome_percentage": 0.7,
    "transaction_id": "1000000906455653",
    "type": "INITIAL_PURCHASE"
  }
}

👍

You've done it!

You should start seeing subscription data from RevenueCat appear in Statsig.