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
- Make sure you have Firebase SDK installed. Check the official Firebase SDK documentation here
- Set Qonversion SDK following Installing the SDKs guides.
- 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
- 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
- Navigate to the Tools → Integrations section in your Qonversion account
- Choose your platform (IOS or Android) and click the Add new + button and select Firebase
- Provide the API Secret and App ID copied in the first step to the corresponding fields
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
- Use Google default event names for revenue metrics to be computed accurately. Examples: purchase and refund.
- Avoid using Google reserved event names: in_app_purchase, notification_receive, user_engagement, etc.
- Other event names can be customised.
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"
}
}
]
}
Updated 9 days ago