Firebase and Google Analytics

Learn how to setup Firebase integration and get insights from Google Analytics

If you use such Google products as Google Analytics, Firebase, and BigQuery you may enrich your analytical data with events from Adapty using the integration described in this article. Events are sent through Google Analytics to Firebase and may be used in any of these services.

1. Set up Firebase

First of all, you have to enable integration between Firebase and Google Analytics. You can do it in your Firebase Console in the Integrations tab.


Integrate Firebase and Google Analytics

2. Integrate with Adapty

Then Adapty needs your Firebase App ID and Google Analytics API Secret to send events and user properties. You can find these parameters in Firebase Console and Google Analytics Data Streams Tab respectively.


Firebase App ID


Retrieving Google Analytics Secret. Step 1


Retrieving Google Analytics Secret. Step 2


Retrieving Google Analytics Secret. Step 3

Then, your next step will be adjusting integration in Adapty Dashboard. You will need to provide Firebase App ID and Google Analytics API Secret to us.


Setting up integration in Adapty Dashboard

3. Set up Adapty SDK

Then you have to set up Adapty SDK to associate your users with Firebase. For each user, you should send thefirebase_app_instance_id to Adapty. Here you can see an example of the code which can be used to integrate Firebase SDK and Adapty SDK.

import FirebaseCore
import FirebaseAnalytics

if let appInstanceId = Analytics.appInstanceID() {            
    let builder = AdaptyProfileParameters.Builder()
        .with(firebaseAppInstanceId: appInstanceId)
    Adapty.updateProfile(params: { error in
                // handle error
//after Adapty.activate()

FirebaseAnalytics.getInstance(context).appInstanceId.addOnSuccessListener { appInstanceId ->
    ) {
        //handle error
//after Adapty.activate()

FirebaseAnalytics.getInstance(context).getAppInstanceId().addOnSuccessListener(appInstanceId -> {
    AdaptyProfileParameters params = new AdaptyProfileParameters.Builder()
    Adapty.updateProfile(params, error -> {
        if (error != null) {
            // handle the error
import 'package:firebase_analytics/firebase_analytics.dart';

final builder = AdaptyProfileParametersBuilder()
          await FirebaseAnalytics.instance.appInstanceId,
try {
    await adapty.updateProfile(;
} on AdaptyError catch (adaptyError) {
    // handle error
} catch (e) {}
import analytics from '@react-native-firebase/analytics';
import { adapty } from 'react-native-adapty';

try {
  const appInstanceId = await analytics().getAppInstanceId();

  await adapty.updateProfile({
    firebaseAppInstanceId: appInstanceId,
} catch (error) {
  // handle `AdaptyError`
                .ContinueWith((task) => {
                    if (!task.IsCompletedSuccessfully) {
                        // handle error

                    String firebaseId = task.Result;

                    var builder = new Adapty.ProfileParameters.Builder();

                    Adapty.UpdateProfile(builder.Build(), (error) => {
                        // handle error

4. Sending events and user properties

And now it is time to decide which events you will receive in Firebase and Google Analytics.


Events names in Adapty Dashboard

You can see that some events have designated names, for example. "Purchase", while other ones are usual Adapty events. This discrepancy comes from Google Analytics event types. Currently, supported events are Refund and Purchase. Other events are custom events. So, please ensure that your event names are supported by Google Analytics.
Also, you can set up sending user properties in the Adapty dashboard.


Enabling "Send user properties" in Adapty Dashboard

This means that your events will be enriched with subscription status and subscription_product_id. But you also have to enable this feature in Google Analytics.


Create User Property in Google Analytics. Step 1


Create User Property in Google Analytics. Step 2

Please check that your user properties names are subscription_status and subscription_product_id. Otherwise, we won't be able to send you subscription status data.


There is a time delay between when events are sent from Adapty and when they appear on the Google Analytics Dashboard. It's suggested to monitor the Realtime Dashboard on your Google Analytics account to see the latest events in real-time.

And that's all! Wait for new insights from Google.