Connect Firebase to RevenueCat
Send purchase events to Google Analytics for Firebase and use supported Firebase data syncs.
RevenueCat's Firebase integration sends subscription lifecycle events to Google Analytics for Firebase, and keeps Cloud Firestore and Firebase Authentication in sync with your Customers' purchases. This article shows you how to identify your Customers with their Firebase UID and set up the Google Analytics part. By the end, RevenueCat's events will show up in your Google Analytics reports.
The Firebase integration is available to all users signed up after September '23, the legacy Starter and Pro plans, and Enterprise plans. If you're on a legacy Free plan and want to access this integration, migrate to our new pricing via your billing settings.
The integration has two parts that work independently of each other:
- Google Analytics: RevenueCat sends subscription lifecycle events to Google Analytics through the Measurement Protocol. This article covers its setup.
- Firebase function kit: a Cloud Function you install in your Firebase project. It stores customer information and events in Cloud Firestore, sets a custom claim with each user's active Entitlements on Firebase Authentication users, and can publish Eventarc events. See Install the Firebase function kit.
Migrate from the extension to the Firebase function kit before March 31, 2027, when Google shuts down Firebase Extensions. The function kit replaces the extension. The Google Analytics part of this integration doesn't use Firebase Extensions and isn't affected.
Each part of the integration requires additional setup, which you can see outlined in the table below.
| Integration | What's required |
|---|---|
| Google Analytics | ✅ $firebaseAppInstanceId customer attribute ❌ (optional, but highly recommended) Setting Firebase user identity |
| Firebase function kit | ✅ Setting Firebase user identity |
Integration at a Glance
| Includes Revenue | Supports Negative Revenue | Sends Sandbox Events | Includes Customer Attributes | Sends Transfer Events | Optional Event Types |
|---|---|---|---|---|---|
| ✅ | ❌ | ✅ | ❌ | ✅ | ❌ |
1. Set up Firebase services in your project
To identify your Customers by their Firebase UID in step 2, set up Firebase Authentication in your Firebase project. Then enable the sign-in methods you want to offer your users in the Firebase console.
The Firebase function kit also needs Cloud Firestore. Its prerequisites list what to set up.
2. Set Firebase user identity in RevenueCat
Use the Firebase UID as the RevenueCat App User ID: when Firebase Authentication signs a user in, log them in to RevenueCat with their UID. This step is optional for Google Analytics, but highly recommended. The Firebase function kit requires it, because it keys customer documents and custom claims by App User ID.
- Swift
3. Send analytics events to Google Analytics
In order to send subscriber lifecycle events to Google Analytics, you must set the $firebaseAppInstanceId as an Attribute for your Customers and enable the integration from the RevenueCat integration settings page.
Set $firebaseAppInstanceId as a customer attribute
Please ensure you're getting the app instance ID from the Firebase Analytics package.
- Swift
Setting an incorrect app instance ID will prevent events from displaying in Google Analytics.
Enable Google Analytics
You can "turn on" the integration from the RevenueCat dashboard.
- Navigate to your project settings in the RevenueCat dashboard and choose 'Firebase' from the Integrations menu

- Add your Firebase App ID and API secret for your iOS app and/or Android app
To set up your Firebase App ID, navigate to Google Analytics > Admin > Data Streams > iOS/Android > Add Stream. Open the App Stream to find your Firebase App ID. Copy and paste into the RevenueCat settings page.

To find your API secret, in the same App stream details page select Measurement Protocol API secrets. Create an API secret. Copy and paste into the RevenueCat settings page.
- Select whether you want RevenueCat to report sales in purchased currency (original currency or in US dollar)
- Select whether you want sales reported as gross revenue (before app store commission), or after store commission and/or estimated taxes.
Events
The Google Analytics portion of the Firebase integration tracks the following events:
| Event Type | Default Event Name | Description | App Store | Play Store | Amazon | Stripe | Promo |
|---|---|---|---|---|---|---|---|
| Initial Purchase | purchase | A new subscription has been purchased. | ✅ | ✅ | ✅ | ✅ | ❌ |
| Trial Started | rc_trial_start | The start of an auto-renewing subscription product free trial. | ✅ | ✅ | ✅ | ✅ | ❌ |
| Renewal (incl. trial conversion) | purchase | An existing subscription has been renewed or a lapsed user has resubscribed. | ✅ | ✅ | ✅ | ✅ | ❌ |
| Cancellation (incl. during trial) | rc_cancellation | A subscription or non-renewing purchase has been cancelled. See cancellation reasons for more details. | ✅ | ✅ | ✅ | ✅ | ✅ |
| Uncancellation | rc_uncancellation | A non-expired cancelled subscription has been re-enabled. | ✅ | ✅ | ✅ | ❌ | ❌ |
| Non Subscription Purchase | purchase | A customer has made a purchase that will not auto-renew. | ✅ | ✅ | ✅ | ✅ | ✅ |
| Subscription Paused | rc_subscription_paused | A subscription has been paused. | ❌ | ✅ | ❌ | ❌ | ❌ |
| Expiration | rc_expiration | 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 | 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 | 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. | ✅ | ✅ | ❌ | ✅ | ❌ |
| Transfer | rc_transfer_event | A transfer of transactions and entitlements was initiated between one App User ID(s) to another. Please note: Two events will be sent for each transfer, one for the original user and another for the destination user. | ✅ | ✅ | ✅ | ✅ | ❌ |
Testing Google Analytics
Make a sandbox purchase with a new user
Simulate a new user installing your app, and go through your app flow to complete the sandbox purchase.
Check Google Analytics Dashboard
Navigate to Google Analytics > Reports > Realtime. Here you will be able to confirm events have been successfully dispatched to Google Analytics. It can take up to a few seconds or minutes for your events to appear.

Firebase A/B Testing
While these events will appear in Firebase, Google does not allow events that are submitted via the Google Analytics 4 Measurement Protocol API to be used with Firebase A/B testing at this time. Since the integration uses this API, these events are not yet compatible with Firebase A/B Testing.
Send customer information to Firestore
Customer information in Cloud Firestore, custom claims with active Entitlements, and Eventarc events come from the Firebase function kit. To set it up, follow Install the Firebase function kit.
Using the RevenueCat Firebase Extension? It's deprecated. Migrate from the extension to the Firebase function kit before March 31, 2027, when Google shuts down Firebase Extensions.