# Google Analytics

With the Google Analytics integration, you'll be able to track app events and analyze how your users are using the app.

In order to integrate this feature, you'll need to create a [Firebase](https://firebase.google.com/) project.&#x20;

{% hint style="info" %}
This feature is available for the [Advanced and ](https://projects.bravostudio.app/pricing)[Business App](https://projects.bravostudio.app/pricing) plans. Also, you'll need to create an app bundle with latest Firebase configuration files and publish the app to start tracking events. Alternatively, you can upload your iOS bundle to Testflight or create a debug APK to test this feature without publishing the app.
{% endhint %}

Follow the steps below to start using this feature in your apps!

## 1. Configure your Firebase project

{% hint style="info" %}
If you already have connected a Firebase project to your app, you can jump to this step.
{% endhint %}

First, create a new [Firebase](https://console.firebase.google.com/) project. You'll need to have a Google account, or create a new one.

### Create a new project

When creating a new project, select the option "Enable Google Analytics":

<figure><img src="https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXpqEanvOhm8vMtIH8i%2Fuploads%2F1SSyBmxgeUwi21I7LjrM%2Fimage.png?alt=media&#x26;token=5eeafd30-91c7-4b05-b2ab-a960c0ae8e58" alt=""><figcaption></figcaption></figure>

After accepting the terms, you'll be redirected to the overview page. Here, you'll need to create one app for Android and another one for iOS. To do that, click on the icons shown in the home page:

<figure><img src="https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXpqEanvOhm8vMtIH8i%2Fuploads%2F7GM4oNO22tVm1lHcqGMP%2Fimage.png?alt=media&#x26;token=81881b88-0ebe-40d2-8f05-3b15e7b38c66" alt=""><figcaption></figcaption></figure>

In the <mark style="color:red;">`Register App`</mark> step, you'll need to fill in the bundle ID (iOS) or package name (Android) for your app. These need to match with the ones you've indicated in the <mark style="color:red;">`Publish`</mark> section of your Bravo app project.&#x20;

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXpqEanvOhm8vMtIH8i%2Fuploads%2Fv0poRPVQHIlYS1Ucmqqm%2Fimage.png?alt=media\&token=c208568e-787b-4550-b362-a95efa034f33)

After registering the app, download the configuration files (GoogleServices files) for both the Android and iOS apps, since you'll need to add them into Bravo.

## 2. Enable Google Analytics

{% hint style="info" %}
In case you selected <mark style="color:red;">`Enable Google Analytics`</mark> when creating the Firebase project, you can skip this section.
{% endhint %}

To enable Google Analytics in your Firebase project, go to <mark style="color:red;">`Analytics`</mark> -> <mark style="color:red;">`Dashboard`</mark>. Here, click on <mark style="color:red;">`Enabling Google Analytics`</mark>.&#x20;

<figure><img src="https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXpqEanvOhm8vMtIH8i%2Fuploads%2Fqtk9ATNN3xrVrPNo18q7%2Fimage.png?alt=media&#x26;token=043bce7a-500c-47a4-93a7-7be3f792cf48" alt=""><figcaption></figcaption></figure>

In the first step, select <mark style="color:red;">`Default account for Firebase`</mark>. Remember to update the Firebase configuration files in Bravo, when you do a change in Firebase configuration, like enabling Firebase Analytics.

Now the Firebase setup is ready! To start using analytics in your app, jump to the next section to see how to set up your Bravo project.

## 3. Setting up Google Analytics in your Bravo app project

1. Upload the two Google Services files for iOS/Android in the <mark style="color:red;">`Integrations`</mark> -> <mark style="color:red;">`Firebase Config`</mark> section of your app project, in case you haven't done that yet. You'll need to upload the files in the final app section. Analytics can't be tested on Bravo Vision.

<figure><img src="https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXpqEanvOhm8vMtIH8i%2Fuploads%2FeYja8L19meQ9uoIDfyPv%2Fimage.png?alt=media&#x26;token=e3869d11-a547-491f-832b-fa63c3465023" alt=""><figcaption></figcaption></figure>

2\. Go to <mark style="color:red;">`Integrations`</mark> -> <mark style="color:red;">`Analytics`</mark> and enable <mark style="color:red;">`Firebase Analytics`</mark>.

<figure><img src="https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXpqEanvOhm8vMtIH8i%2Fuploads%2FvAyrZfIDE6W26mSYX9GT%2Fimage.png?alt=media&#x26;token=e6677929-ab4d-4e10-9e04-e929995cf7f9" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
If you miss to enable Firebase Analytics in your Bravo app project, Google Analytics will only show limited events from Android phones (none from iOS). To fix this, enable Firebase Analytics in Bravo and Firebase console, update the files in Bravo and generate new builds for both OS.
{% endhint %}

## 3. Create new app bundles

After setting up the analytics feature, you'll need to create new app bundles for iOS and Android. In case you haven't created them yet, follow the [Publication](https://docs.bravostudio.app/app-publication/publishing-your-app) section to learn how to do that.

Once the app bundles are live, you should be able to start tracking analytics for your app in your Firebase project!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bravostudio.app/integrations/google-analytics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
