# Firebase

{% hint style="warning" %}
Firebase Crashlytics data available via Google APIs cannot be used for calculating aggregate stats like crash-free rate or adoption rate, because it only contains info on unhealthy sessions: without info on healthy session stats, there is no denominator for crash-free rates or adoption.

As a result, Runway's stability monitoring integration for Firebase relies on Google Analytics data, and that data must be exported from Firebase to BigQuery so that Runway can query it.
{% endhint %}

## Set up in Firebase

### Find your Firebase Project ID

1. Navigate to your Firebase console (:link: <https://console.firebase.google.com>), and select the Firebase project for your app(s)
2. Click on the gear icon top left, choose “Project settings”

   ![](https://727226624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjFmyReUsbJqDjHEAlW%2Fuploads%2FEjG7a5u8U3hNLBKRtF9c%2FFirebase%20-%20Project%20settings%20menu.png?alt=media\&token=d1c1765b-7637-41fe-a8a9-e86703de6106)
3. On the “General” tab, make note of the **Project ID**. You’ll need to enter this value in Runway shortly

### Find your Google Analytics Property ID

1. Click on the **Integrations** tab
2. Next, ensure that the **Google Analytics** tile in your Firebase console is showing the status "Enabled". If it’s not, you'll need to :link: [set up and enable Google Analytics](https://firebase.google.com/docs/analytics/get-started) in your project

   ![](https://727226624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjFmyReUsbJqDjHEAlW%2Fuploads%2Fe76vF8XowwAK9cfGeezo%2FFirebase%20-%20Google%20Analytics%20tile.png?alt=media\&token=812691c0-0548-4e2a-b5c5-f8692c59acd7)
3. Click into the **Google Analytics** tile. It should show your app(s) in the bottom section, and at the top there should be a **Property ID**. Grab that value; you’ll need to enter it shortly in Runway
4. Click the link under "Linked Google Analytics account"
5. Under "Product links", click "BigQuery links"
6. Click on the row for your Firebase project
7. On the sheet that opens, under 'Event data', ensure that at least one 'Export type' is selected

### BigQuery + GA settings

{% hint style="danger" %}
Setting up BigQuery is required because Google doesn't expose user- and session-level stability data directly via Firebase APIs.

**Data processed, and therefore costs, can be variable depending on each team's data volume and other factors.** We recommend adding user- and/or project-level quotas to cap query data processed per day. More information is available here: :link: [Controlling your BigQuery costs - Google Cloud](https://cloud.google.com/blog/topics/developers-practitioners/controlling-your-bigquery-costs)

If your team doesn't otherwise use Google Analytics, one way to limit data volume is to filter the events it sends/ingests. The only events Runway needs for this integration to work are `session_start` and `app_exception`. See Google documentation around data and filtering here: :link: [BigQuery Export limits and data filtering](https://support.google.com/analytics/answer/9823238?ref_topic=9359001#limits\&zippy=%2Cin-this-article)
{% endhint %}

1. Click back up to **Integrations**
2. Click into the **BigQuery** tile. If you haven’t yet linked BigQuery to Firebase, you’ll be prompted to do so. Once you’re linked, you’ll see a list of integrations to configure. Or, if you were already linked, you’ll also see that list of integrations

   ![](https://727226624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjFmyReUsbJqDjHEAlW%2Fuploads%2FWCSCJklwnDX7MCcArH3l%2FFirebase%20-%20BigQuery%20tile.png?alt=media\&token=bfc15e1c-636f-451d-aaec-1b0f39668476)
3. Find the **Google Analytics** integration, and flip that switch ON
4. In **Apps exporting**, make sure the app(s) in question are selected
5. In **Export settings**, make sure at least the “Daily” option is selected

   ![](https://727226624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjFmyReUsbJqDjHEAlW%2Fuploads%2FYayZaKwheDmQqHf7fCMa%2FFirebase%20-%20Configure%20BigQuery%20%2B%20Google%20Analytics.png?alt=media\&token=50a9aa02-e60a-4d35-9fad-b08757386f4d)

{% hint style="warning" %}
Note that you must be on a Firebase paid plan to select “Streaming” exports in Export settings, and without “Streaming” enabled, data flowing into Runway won’t be real-time.
{% endhint %}

{% hint style="warning" %}
For BigQuery exports that have been turned on for the first time, it may take a day before the data starts populating in BigQuery.
{% endhint %}

**Save** your settings.

## Service account / API key setup

1. Head to the :link: [Google Cloud Platform](https://console.cloud.google.com) console
2. Make sure you’re logged in with an appropriate Google account, *and* that the project that contains the BigQuery instance you linked with Firebase is selected in the project selector (top left)
3. In the left hand menu, select **IAM & Admin** and then **Service Accounts**

   ![](https://727226624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjFmyReUsbJqDjHEAlW%2Fuploads%2FhAhN6gPCUNprDpVYEwZN%2FFirebase%20-%20Cloud%20Console%20menu.png?alt=media\&token=7c0ab590-11ad-4d7a-a634-6142f485006a)
4. Click **+ Create Service Account**
5. Fill out the form then click **Create and Continue**
6. In step 2, select roles. You’ll need to select the **BigQuery Job User** and **BigQuery Data Viewer** roles at minimum. If you want to share a service account between Runway’s stability monitoring integration and your Google Play and/or Play Beta integrations, add additional roles as needed (Play Console and BigQuery will need to live under the same project for this to work)

   ![](https://727226624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjFmyReUsbJqDjHEAlW%2Fuploads%2FACcAQ6HMf3JkN2UkE13t%2FFirebase%20-%20Create%20service%20accounts.png?alt=media\&token=02b23420-0eb1-4a6b-bd45-0fd5d0229f5f)
7. On the service account you just created, click the three dots on the right hand side, and select **Manage keys**
8. Click **Add Key**, then **Create new key**
9. Select the **JSON** option and click **Create**
10. Your Google API key file should start downloading

## Set up in Runway

### Navigate to the Integration settings view

1. Select an app in the top left corner from the Switcher
2. Navigate to **App Settings** by clicking the gear icon (⚙️) at the top of the Timeline sidebar
3. Click on **Integrations** in the sidebar

### Connect Firebase

* Find the **Firebase** integration module under the **Stability monitoring** section
* Click the **Connect** button
* Add your Google API key file, Project ID and GA Property ID from the previous steps to complete your integration setup.

## Troubleshooting Firebase

If you are not seeing Firebase data populated in Runway, please follow these steps and send the output to the Runway support team to help troubleshoot:

1. Navigate to your BigQuery console -> open the `analytics_` data set
2. Explore items in a recent `events_` table
3. Share a screenshot of one or two items' `app_info` value with Runway. It will look similar to this:&#x20;

<figure><img src="https://727226624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjFmyReUsbJqDjHEAlW%2Fuploads%2F5QGDhzna76oiyr8jPN07%2FScreenshot%202024-04-15%20at%2018.47.36%20(3).png?alt=media&#x26;token=354ea6a9-29da-463d-a19b-0df0cf57df72" alt="BigQuery console" width="375"><figcaption><p>BigQuery console</p></figcaption></figure>

<figure><img src="https://727226624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjFmyReUsbJqDjHEAlW%2Fuploads%2FcaDM6dxNUvRBt4fCgjxy%2Fimage.png?alt=media&#x26;token=ab0ff91c-f404-4fcc-b2e3-3072147bffde" alt="App info screenshot" width="375"><figcaption><p>Example of BigQuery <code>app_info</code> data </p></figcaption></figure>
