Firebase

Send in-app subscription data to Firebase

Qonversion can send revenue events, including purchases, trial conversions, subscription renewals, and even refunds, to your Firebase account. This allows you to match your users' behaviour with their payment history in Firebase and empower your product decisions.

1. Setup the SDKs

  1. Make sure you have Firebase SDK installed. Check the official Firebase SDK documentation here
  2. Set Qonversion SDK following Installing the SDKs guides.
  3. Send firebaseAppInstanceId to Qonversion via User Properties
if let appInstanceID = Analytics.appInstanceID() {
    Qonversion.shared().setUserProperty(.firebaseAppInstanceId, value: appInstanceID)
}
[[Qonversion sharedInstance] setUserProperty:QONUserPropertyKeyFirebaseAppInstanceId value:[FIRAnalytics appInstanceID]];
FirebaseAnalytics.getInstance(context).getAppInstanceId().addOnCompleteListener(task -> {
    final String appInstanceId = task.getResult();
    if (appInstanceId != null) {
      Qonversion.getSharedInstance().setUserProperty(QUserPropertyKey.FirebaseAppInstanceId, appInstanceId);
    }
});
FirebaseAnalytics.getInstance(requireContext()).appInstanceId.addOnCompleteListener { task ->
    task.result?.let { appInstanceId ->
        Qonversion.shared.setUserProperty(QUserPropertyKey.FirebaseAppInstanceId, appInstanceId)
    }
}
Qonversion.getSharedInstance().setUserProperty(QUserPropertyKey.firebaseAppInstanceId, appInstanceId);
Qonversion.getSharedInstance().setUserProperty(UserPropertyKey.FIREBASE_APP_INSTANCE_ID, appInstanceId);
Qonversion.GetSharedInstance().SetUserProperty(UserPropertyKey.FirebaseAppInstanceId, appInstanceId);
Qonversion.getSharedInstance().setUserProperty(Qonversion.UserPropertyKey.FIREBASE_APP_INSTANCE_ID, appInstanceId);
Qonversion.getSharedInstance().setUserProperty(UserPropertyKey.FIREBASE_APP_INSTANCE_ID, appInstanceId);

🚧

Measurement app_instance_id is expected to be a 32-digit hexadecimal number.

Example of app_instance_id B18FE2FF75795C219BCD30B58377C5ED

2. Configure the Firebase Integration

  1. Copy your Firebase App ID and Measurement Protocol API secret from the Google Analytics Console: Admin → Data Streams → Select existing or create a new stream for your App
2422

App data stream details page

  1. Navigate to the Tools → Integrations section in your Qonversion account
  2. Choose your platform (IOS or Android) and click the Add new + button and select Firebase
  3. Provide the API Secret and App ID copied in the first step to the corresponding fields
2416

Qonversion Firebase integration setting screen

3. Pay attention to event names

Event names:

  • Must be 40 characters or fewer
  • May only contain alpha-numeric characters and underscores
  • Must start with an alphabetic character.

Names

👍

Done

Qonversion will send In-App purchases and subscription events to your Firebase account. You can make changes to event names and other setting on the Firebase integration settings page in Qonversion.

Event Payload

In case you need details about data sent to Firebase, follow the example below:

{
   "app_instance_id":"",
   "user_id":"QON_...",
   "events":[
      {
         "name":"event_name",
         "params":{
            "transaction_id":"",
            "items":[
               {
                  "item_id":"product_id"
               }
            ],
            "value":7.7,
            "currency":"CHF"
         }
      }
   ]
}