Integrate in-app subscription events from RevenueCat with Segment


The Segment integration is available on the Pro plan.

Segment 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 Segment to collect data on customer events to create a single view customer portfolio using an API.

With our Segment integration, you can:

  • Create an onboarding flow for users who have subscribed but have not yet engaged with the tutorial or first steps of your product.
  • Send personalized messages to users who have free trials that are about to expire.

With accurate and up-to-date subscription data in Segment, you'll be set to turbocharge your user engagement ⚑️


The Segment integration tracks the following events:



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.


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


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


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.


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

Product Change

When user 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 Segment.


1. Set Segment User Identity

If you're using the Segment SDK, you can set the User ID to match the RevenueCat App User Id. This way, events sent from the Segment SDK and events sent from RevenueCat can be synced to the same user.

Use the .identify() method on the Segment 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 Segment
// Configure Purchases SDK
[RCPurchases configureWithAPIKey:@"public_sdk_key" appUserID:@"my_app_user_id"];

// Set App User Id in Segment
[[SEGAnalytics sharedAnalytics] identify:@"my_app_user_id"];
// Configure Purchases SDK
Purchases.configure(this, "public_sdk_key", "my_app_user_id");

// Set App User Id in Segment
Analytics.with(context).identify("my_app_user_id", null, null);

2. Generate a Segment Write Key

In Segment, add a HTTP API as a source and copy the Write Key.


3. Send RevenueCat events to Segment

After you've set up the Purchases SDK and Segment 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 Segment from the integrations menu.
  2. Add your Segment Write Key from step 2.
  3. Enter the event names that RevenueCat will send or choose the default event names.
  4. Select whether you want sales reported as gross revenue (before app store commission), or after store commission and/or estimated taxes.
  5. Select whether you want RevenueCat to send sandbox events into Segment or not. You can check the environment key in the context property of the event to determine if it was triggered in a sandbox or production environment.

Segment configuration screen

Sample Event

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

  "identify": {
    "context": {
      "environment": "production",
      "library": {
        "name": "RevenueCat Segment events",
        "version": "1.0"
    "timestamp": "2021-03-20T00:00:02",
    "traits": {
      "aliases": [
      "last_seen_app_user_id": "myCustomAppUserId"
    "userId": "$RCAnonymousID:0123456789abcdefghij0123456789ab"
  "track_event": {
    "context": {
      "environment": "production",
      "library": {
        "name": "RevenueCat Segment events",
        "version": "1.0"
    "event": "renewal_event",
    "properties": {
      "app_user_id": "myCustomAppUserId",
      "currency": "USD",
      "entitlements": [
      "entitlement": "your_entitlement_id",
      "expires_at": 1647734402,
      "original_app_user_id": "$RCAnonymousID:0123456789abcdefghij0123456789ab",
      "product_id": "your_product_id",
      "revenue": 9.99,
      "store": "APP_STORE",
      "purchased_at": 1616198402,
      "subscriber_attributes": {
        "$ip": "",
        "$idfa": "12345678-1234-1234-1234-123456789abc",
        "$idfv": "12345678-1234-1234-1234-123456789abc",
        "$email": "[email protected]",
        "$fbAnonId": "12345678-1234-1234-1234-123456789abc",
        "$apnsTokens": "fY1kOQ0bMl8:APA91bG_rM-ub0xg:DNjP553d8O8gTYs9iNWsYxZMLyzv46IhB--2qz810LRUhCIXTJE4_Umx-irs-FD6ET_qMCXyNeny7B6xn2-X0v69Be014Qa4BHv2XSTwrmF5PZ2L_LPxw4sL2_s1",
        "$appsflyerId": "0123456789012-0123456",
        "favorite_food": "pizza"
      "period_type": "NORMAL",
      "environment": "PRODUCTION",
      "presented_offering_id": "default",
      "transaction_id": "012345678912345",
      "original_transaction_id": "987654321098765",
      "aliases": [
    "timestamp": "2021-03-20T00:00:02",
    "userId": "$RCAnonymousID:0123456789abcdefghij0123456789ab"

Did this page help you?