ο»Ώ

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 ⚑️

# Events

The Segment integration tracks the following events:

Event TypeDefault Event NameDescriptionApp StorePlay StoreAmazonStripePromo
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 Issue`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 Segment.

# Setup

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

ο»Ώ

## 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. Choose your Segment region.

  3. Add your **Segment Write Key** from step 2.

  4. Enter the event names that RevenueCat will send or choose the default event names.

  5. Select whether you want sales reported as gross revenue (before app store commission), or after store commission and/or estimated taxes.

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

1097
ο»Ώ

Segment configuration screen

# Sample Events

Below are sample JSONs that are delivered to Segment for each event type.

ο»Ώ
ο»Ώ