Firebase (Beta)

This guide describes how to add and configure Firebase and Google Analytics integration.

You can send subscription renewal events as well as non-renewing events to Firebase and Google Analytics using this integration.

Limitations

  • This integration is in Beta, because Google Analytics API is marked as Beta.

  • Viewing events sent by Apphud in A/B experiment page is not currently supported by Firebase.

  • Events are being processed in Firebase & Google Analytics within a few hours (usually 3-6 hours).

  • Since Firebase SDK automatically tracks in-app purchases when app is running, you may see increased LTV value because it will be a sum of Firebase and Apphud tracked events. Currently there is no way to disable automatic purchase events collection from Firebase.

Requirements

  • Apphud iOS SDK 2.2.0 or higher.

  • Apphud Android SDK 1.2.0 or higher.

  • Send Firebase Instance ID to Apphud, see instructions below.

How to Add Integration?

Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7
Step 8
Step 1
  • Integrate Apphud SDK.

  • Integrate Firebase.

  • Send Firebase Instance ID to Apphud. See below.

Step 2
  • Open Google Analytics and go to Admin settings of your project.

  • Go to Data Streams and open your App's Stream details page.

Step 3

At App stream details page find and copy Firebase App ID field.

Step 4

Under Additional settings go to Measurement Protocol API secrets page and create a new API Secret if it doesn't exist. Copy the value.

Step 5

At Apphud go to "Integrations" section and add Firebase:

Step 6
  • Paste Firebase App ID.

  • Paste Client API Secret.

Step 7

You can enable or disable each particular event:

Step 8

Enable integration and click Save:

[Required] Send Firebase Instance ID to Apphud

In order to send events Apphud must know Firebase Instance ID. This value can only be retrieved from the app. Here is a sample code how to send Firebase Instance ID to Apphud:

Swift
Kotlin
Swift
// iOS SDK 2.2.0 or higher
if let instanceID = Analytics.appInstanceID() {
Apphud.addAttribution(data: nil, from: .firebase, identifer: instanceID, callback: nil)
}
Kotlin
FirebaseAnalytics.getInstance(this).appInstanceId.addOnSuccessListener { instanceID ->
Apphud.addAttribution(ApphudAttributionProvider.firebase, null, instanceID)
}.addOnFailureListener {
// Optional - Show some error
}.addOnCanceledListener {
//Optional - Show some error
}

Events Mapping

Events are mapped in the following way:

Apphud Event Name

Firebase Event Name

Trial Started

apphud_trial_started

Trial Converted, Subscription Started, Subscription Renewed and other revenue events

purchase

Trial Canceled, Subscription Canceled, Paywall Checkout Initiated, etc.

apphud_trial_canceled, apphud_subscription_canceled,

apphud_paywall_checkount_initiated, etc.

Subscription Refunded

refund

User Properties

You must have at least one event to be successfully sent to Firebase. When event is processed by Firebase, User Properties will appear in desired selection. Keep in mind that events are being processed in Firebase & Google Analytics within a few hours (usually 3-6 hours).

Besides events, Apphud also sends User Properties to Firebase. This helps you to create custom audiences or Custom Definitions and target specific users in A/B tests or view analytics for specific audience. The list of User Properties and its values can be found here.

Custom Dimensions

In order to use User Properties in your analytics you should first assign them to a custom dimension.

  • Open your Firebase Console > Custom Definitions > Create custom dimensions.

  • While creating custom dimensions select User scope.

  • Enter name and description.

  • Select User Property, for example, apphud_payments_count. Click Save.

Custom Audiences

In order to create custom audience using Apphud User Property you should first create Custom Dimension. See instructions above.

After creating a custom dimension, you can create custom audiences.

  • Open your Firebase Console > Audiences > Create custom dimensions.

  • Select Custom > your custom dimension name, for example, apphud_total_spent

  • Edit condition on this property, for example, > 0. Click Save.

  • Custom Audience is now available in both Firebase and Google Analytics.

View Firebase A/B test results in Apphud

You can view results of A/B tests in Apphud by sending remote config values to our service. You will be able to add filter of your test variant for every chart including cohort chart.

See this great blog post for details.