Skip to main content
Skip to navigation

Connect Firebase to RevenueCat

Send purchase events to Google Analytics for Firebase and use supported Firebase data syncs.

Ask RicoChatGPTClaude

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.

👍Pro Integration

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.
⚠️Using the RevenueCat Firebase Extension?

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.

IntegrationWhat'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 RevenueSupports Negative RevenueSends Sandbox EventsIncludes Customer AttributesSends Transfer EventsOptional 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.

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.

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.

  1. Navigate to your project settings in the RevenueCat dashboard and choose 'Firebase' from the Integrations menu

Integration setup

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

Data stream details 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.

  1. Select whether you want RevenueCat to report sales in purchased currency (original currency or in US dollar)
  2. 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 TypeDefault Event NameDescriptionApp StorePlay StoreAmazonStripePromo
Initial PurchasepurchaseA new subscription has been purchased.✅✅✅✅❌
Trial Startedrc_trial_startThe start of an auto-renewing subscription product free trial.✅✅✅✅❌
Renewal (incl. trial conversion)purchaseAn existing subscription has been renewed or a lapsed user has resubscribed.✅✅✅✅❌
Cancellation (incl. during trial)rc_cancellationA subscription or non-renewing purchase has been cancelled. See cancellation reasons for more details.✅✅✅✅✅
Uncancellationrc_uncancellationA non-expired cancelled subscription has been re-enabled.✅✅✅❌❌
Non Subscription PurchasepurchaseA customer has made a purchase that will not auto-renew.✅✅✅✅✅
Subscription Pausedrc_subscription_pausedA subscription has been paused.❌✅❌❌❌
Expirationrc_expirationA 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 Issuerc_billing_issueThere 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_changeA 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.✅✅❌✅❌
Transferrc_transfer_eventA 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.

Google Analytics dashboard

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.

Was this page helpful?