Skip to main content

Amplitude

👍Pro Integration

The Amplitude integration is to all users signed up after September '23, the legacy Grow and Pro plans, and Enterprise plans. If you're on a legacy Free or Starter plan and want to access this integration, migrate to our new pricing via your billing settings.

Amplitude 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 Amplitude’s product analytics to find patterns in customer behavior and inform marketing strategies.

With our Amplitude integration, you can:

  • Create a behavioral cohort of customers based on specific actions, such as watching a specific episode of a show after subscribing. Follow a cohort throughout their lifecycle to realize overarching trends.
  • Measure the path of a user from marketing material to the purchase of a subscription.

With accurate and up-to-date subscription data in Amplitude, you'll be set to turbocharge your product analytics ⚡️

Integration at a Glance

Includes RevenueSupports Negative RevenueSends Sandbox EventsIncludes Customer AttributesSends Transfer EventsOptional Event Types
Requires API keynon_subscription_purchase_event uncancellation_event subscription_paused_event expiration_event billing_issue_event product_change_event

Events

The Amplitude integration tracks the following events:

EventDefault Event NameDescriptionApp StorePlay StoreAmazonStripePromo
Initial Purchaserc_initial_purchase_eventA new subscription has been purchased.
Trial Startedrc_trial_started_eventThe start of an auto-renewing subscription product free trial.
Trial Convertedrc_trial_converted_eventWhen an auto-renewing subscription product converts from a free trial to normal paid period.
Trial Cancelledrc_trial_cancelled_eventWhen a user turns off renewals for an auto-renewing subscription product during a free trial period.
Renewalrc_renewal_eventAn existing subscription has been renewed or a lapsed user has resubscribed.
Cancellationrc_cancellation_eventA subscription or non-renewing purchase has been cancelled. See cancellation reasons for more details.
Uncancellationrc_uncancellation_eventA non-expired cancelled subscription has been re-enabled.
Non Subscription Purchaserc_non_subscription_purchase_eventA customer has made a purchase that will not auto-renew.
Subscription Pausedrc_subscription_paused_eventA subscription has been paused.
Expirationrc_expiration_eventA 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 Issuesrc_billing_issue_eventThere 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 Changerc_product_change_eventA 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 Amplitude.

Setup

1. Set Amplitude User Identity

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

Configure the Amplitude SDK with the same App User Id as RevenueCat or use the .setUserId() method on the Amplitude SDK.

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

// Configure Amplitude SDK
Amplitude.instance()?.initializeApiKey("amplitude_api_key", userId: "my_app_user_id")

// Optional User Alias Object attributes
Purchases.shared.attribution.setAttributes(["$amplitudeDeviceId": <AMPLITUDE_DEVICE_ID>])

Send Amplitude User Identifiers to RevenueCat (Optional)

If your App User ID in RevenueCat is different than the User ID in Amplitude, you can use the Amplitude User ID and/or Amplitude Device ID to identify events by adding a key as an Attributes.

KeyDescription
$amplitudeDeviceIdThe Amplitude Device ID
$amplitudeUserIdThe Amplitude User ID

If both keys are present, RevenueCat will send both the User ID and Device ID to identify events into Amplitude. If only one of the keys are present, RevenueCat will only send the available key. If no keys are present, RevenueCat will send the current RevenueCat App User ID. This property can be set and removed manually, like any other Attribute. For more information how Amplitude tracks unique users, view their docs here.

2. Send RevenueCat Events to Amplitude

After you've set up the Purchases SDK and Amplitude 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 Amplitude from the Integrations menu
  2. Add your Amplitude API key
  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.

Amplitude configuration page

Set Amplitude Region (Optional)

If your Amplitude account is hosted on EU servers, toggle the Amplitude Region field to EU in the Amplitude integration settings. The region defaults to US.

Sample Event

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

{
"api_key": "yourAmplitudeAPIKey",
"event": {
"event_type": "rc_initial_purchase_event",
"partner_id": "revenuecat",
"insert_id": "a12bc3d4-e5fg-678h-91i0-j23klmn45678",
"time": 1662493499000,
"platform": "iOS",
"revenue": 7.61,
"productId": "rc_subscription_monthly",
"event_properties": {
"subscriber_attributes": {
"$attConsentStatus": "denied",
"$amplitudeDeviceId": "123a4b56-7890-12cd-345e-67f90gh1ij1k"
},
"period_type": "NORMAL",
"purchased_at": "2022-09-06T19: 44: 59Z",
"expiration_at": "2022-10-06T19: 44: 59Z",
"environment": "PRODUCTION",
"entitlement_id": "pro",
"entitlement_ids": [
"pro"
],
"presented_offering_id": null,
"transaction_id": "123456789012345",
"original_transaction_id": "011223344556677",
"aliases": [
"$RCAnonymousID: 121abc123a4abc123123abc123abc1230"
],
"original_app_user_id": "$RCAnonymousID: 1234567890ab1cd1234a55b6c78910a3",
"store": "APP_STORE",
"app_user_id": "$RCAnonymousID: 1234567890ab1cd1234a55b6c78910a3",
"product_id": "rc_subscription_monthly",
"currency": "EUR",
"revenue": 7.61,
"app_id": "app1234567890"
},
"user_id": "$RCAnonymousID: 1234567890ab1cd1234a55b6c78910a3"
}
}
{
"api_key": "yourAmplitudeAPIKey",
"event": {
"event_type": "rc_non_subscription_purchase_event",
"partner_id": "revenuecat",
"insert_id": "a12bc3d4-e5fg-678h-91i0-j23klmn45678",
"time": 1662421921000,
"platform": "iOS",
"revenue": 9.99,
"productId": "rc_coins",
"event_properties": {
"subscriber_attributes": {
"$attConsentStatus": "denied",
"$amplitudeDeviceId": "123a4b56-7890-12cd-345e-67f90gh1ij1k"
},
"period_type": "NORMAL",
"purchased_at": "2022-09-05T23:52:01Z",
"expiration_at": null,
"environment": "PRODUCTION",
"entitlement_id": null,
"entitlement_ids": null,
"presented_offering_id": null,
"transaction_id": "123456789012345",
"original_transaction_id": "011223344556677",
"aliases": [
"$RCAnonymousID: 121abc123a4abc123123abc123abc1230"
],
"original_app_user_id": "$RCAnonymousID: 1234567890ab1cd1234a55b6c78910a3",
"store": "APP_STORE",
"app_user_id": "$RCAnonymousID: 1234567890ab1cd1234a55b6c78910a3",
"product_id": "rc_subscription_monthly",
"currency": "USD",
"revenue": 9.99,
"app_id": "app1234567890"
},
"user_id": "$RCAnonymousID: 1234567890ab1cd1234a55b6c78910a3"
}
}

Subscription Status Attribute

Whenever RevenueCat sends an event to Amplitude, we'll update the rc_subscription_status user attribute with any applicable changes, using one of the following values:

StatusDescription
activeThe customer has an active, paid subscription which is set to renew at their next renewal date.
introThe customer has an active, paid subscription through a paid introductory offer.
cancelledThe customer has a paid subscription which is set to expire at their next renewal date.
grace_periodThe customer has a paid subscription which has entered a grace period after failing to renew successfully.
trialThe customer is in a trial period which is set to convert to paid at the end of their trial period.
cancelled_trialThe customer is in a trial period which is set to expire at the end of their trial period.
grace_period_trialThe customer was in a trial period and has now entered a grace period after failing to renew successfully.
expiredThe customer's subscription has expired.
promotionalThe customer has access to an entitlement through a RevenueCat Granted Entitlement
expired_promotionalThe customer previously had access to an entitlement through a RevenueCat Granted Entitlement that has since expired.
pausedThe customer has a paid subscription which has been paused and is set to resume at some future date.

For customers with multiple active subscriptions, this attribute will represent the status of only the subscription for which the most recent event occurred. Therefore, we recommend using rc_active_entitlements to understand whether your customers have multiple active subscriptions to be accounted for.

Please note that since this attribute is set and updated when events are delivered, subscribers with events prior to our release of this attribute (during November 2023) will not have this attribute set until/unless a future event (renewal, cancellation, etc) occurs.