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

0. Matching RevenueCat Users with Statsig Users

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.

1. Enable RevenueCat integration with Statsig

On the Statsig Integration page enable the RevenueCat integration.

Enable RevenueCat in Statsig integration pageEnable RevenueCat in Statsig integration page

Enable RevenueCat in Statsig integration page

2. 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
  1. Choose Statsig from the Integrations menu.
  2. Add your 'statsig-server-secret'

Remember to select Add Integration

Statsig configuration pageStatsig configuration page

Statsig configuration page

3. Testing the Statsig integration

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

Include Sandbox Events in Statsig integration pageInclude Sandbox Events in Statsig integration page

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 test purchase event in the Customer History page and make sure that the Statsig integration event exists and was delivered successfully.

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'.

Sample Event

Below is 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.


Did this page help you?