---
title: Firebase
slug: experience/firebase
description: Learn about Firebase Analytics, official websites, and developer integrations for Android and iOS platforms. Discover the event support matrix and structure in tracking_config.json. Find out the restrictions for event names, parameters, and attributes, wi
docTags: 
createdAt: 2023-06-30T14:38:06.450Z
---

# Summary

## Official websites

| **Site**      | **URL**                                                                    |
| ------------- | -------------------------------------------------------------------------- |
| Website       | [https://firebase.google.com](https://firebase.google.com/docs/analytics)  |
| Documentation | [https://firebase.google.com/docs](https://firebase.google.com/docs?hl=en) |

## Developer integrations

| **Platform** | **URL**                                                                                              |
| ------------ | ---------------------------------------------------------------------------------------------------- |
| Android      | [https://github.com/firebase/firebase-android-sdk](https://github.com/firebase/firebase-android-sdk) |
| iOS          | [https://github.com/firebase/firebase-ios-sdk](https://github.com/firebase/firebase-ios-sdk)         |
| Web          | <font color="#ff6900">not supported by Purple</font>                                                 |

# Tracking service

## Event support matrix

Overview of the supported events and their configuration.

|                                             | **Templates**                         | **Parameter**                              |
| ------------------------------------------- | ------------------------------------- | ------------------------------------------ |
| <font color="#2166ae">**Actions**</font>    | <font color="#3b9f0f">*action*</font> | <font color="#3b9f0f">supported</font>     |
| <font color="#2166ae">**Views**</font>      | <font color="#3b9f0f">*name*</font>   | <font color="#3b9f0f">supported</font>     |
| <font color="#2166ae">**Attributes**</font> | <font color="#3b9f0f">*name*</font>   | <font color="#ff6900">not supported</font> |

<font color="#2166ae">**Purchases**</font> are not supported, since they collected automatically by Firebase.

## General structure in tracking\_config.json

:::hint{type="info"}
Tracking service key name in "*tracking\_config.json*" is:
"<font color="#2166ae">**firebase_analytics**</font>"
:::

:::CodeblockTabs
General structure

```json
{
  
  "firebase_analytics": {
    "eventsEnabledByDefault": true,
    "viewsEnabledByDefault": true,
    "purchasesEnabledByDefault": false,
    "attributesEnabledByDefault": true,
    
    "events": {
      // your configured list of events
    },
    
    "views": {
      // your configured list of events
    },
    
    "purchases": {},
    
    "attributes": {
      // your configured list of attributes
    } 
    
  }
  
}
```
:::

## Event configuration

### Restrictions for tracking

:::hint{type="warning"}
Firebase Analytics has some <font color="#eb144c">**restrictions**</font> for <font color="#ff6900">event names</font>, <font color="#ff6900">event parameters</font> and <font color="#ff6900">attributes</font>. Further descriptions can be found in the official documentation:

**iOS - Swift**

[https://firebase.google.com/docs/reference/swift/firebaseanalytics/api/reference/Classes/Analytics#logevent\_:parameters:](https://firebase.google.com/docs/reference/swift/firebaseanalytics/api/reference/Classes/Analytics#logevent_\:parameters:)

**Android - Kotlin**

[https://firebase.google.com/docs/reference/kotlin/com/google/firebase/analytics/FirebaseAnalytics#logevent](https://firebase.google.com/docs/reference/kotlin/com/google/firebase/analytics/FirebaseAnalytics#logevent)
:::

**Global restrictions for events**

- Up to <font color="#eb144c">500</font> event names are supported.
- An event can have up to <font color="#eb144c">25</font> parameters.
- There are <font color="#eb144c">reserved</font> event names which cannot be used ([iOS](https://firebase.google.com/docs/reference/swift/firebaseanalytics/api/reference/Classes/Analytics#logevent_\:parameters:) and [Android](https://firebase.google.com/docs/reference/kotlin/com/google/firebase/analytics/FirebaseAnalytics.Event)).

**Global restrictions for attributes**

- Up to <font color="#eb144c">25</font> user property names are supported.&#x20;
- The following user property names are <font color="#eb144c">reserved</font> and cannot be used:
  - "<font color="#ff6900">first_open_time</font>"
  - "<font color="#ff6900">first_visit_time</font>" (Android only)
  - "<font color="#ff6900">first_open_after_install</font>" (Android only)
  - "<font color="#ff6900">last_deep_link_referrer</font>"
  - "<font color="#ff6900">user_id</font>"

**Restrictions of an event:**

| **Event**                                                                               | **Restrictions**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <font color="#2166ae">**name**</font>                                                   | - Should contain <font color="#eb144c">1 to 40 alphanumeric</font> characters or&#xA;<font color="#eb144c">underscores</font>
- The name must start with an <font color="#eb144c">alphabetic</font> character.
- The “<font color="#ff6900">firebase_</font>”, “<font color="#ff6900">google_</font>”, and “<font color="#ff6900">ga_</font>” prefixes are <font color="#eb144c">reserved</font> and should not be used.                                                                                                                                                                                                                                                                |
| <font color="#2166ae">**parameter**</font> <font color="#2166ae">**(key/value)**</font> | Parameter <font color="#2166ae">**keys**</font> ...<br />- ... can be up to <font color="#eb144c">40 characters </font>long.
- ... must start with an alphabetic character.
- ... must contain only <font color="#eb144c">alphanumeric</font> characters and <font color="#eb144c">underscores</font>.
- ... must not be prefixed with “<font color="#ff6900">firebase_</font>”, “<font color="#ff6900">google_</font>”, or “<font color="#ff6900">ga_</font>” since these are <font color="#eb144c">reserved</font> prefixes and should not be used.<br />Pameter <font color="#2166ae">**values**</font> ...<br />- ... can be up to <font color="#eb144c">100 characters</font> long |

**Restrictions of an attribute:**

| **Attribute**                          | **Restrictions**                                                                                                                                                                                                                                                                                                                                                                                                                |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <font color="#2166ae">**key**</font>   | - The key should contain <font color="#eb144c">1 to 24 alphanumeric</font> characters or&#xA;<font color="#eb144c">underscores</font>
- The key must start with an <font color="#eb144c">alphabetic</font> character.
- The “<font color="#ff6900">firebase_</font>”, “<font color="#ff6900">google_</font>”, and “<font color="#ff6900">ga_</font>” prefixes are <font color="#eb144c">reserved</font> and should not be used. |
| <font color="#2166ae">**value**</font> | * Values can be up to <font color="#eb144c">36 characters</font> long.                                                                                                                                                                                                                                                                                                                                                          |

### Actions

Firebase supports action events.&#x20;

:::CodeblockTabs
Action event

```json
"action_event_key": {
  "templates": {
    "action": "value of template"
  },
  "parameters": {
    "parameter_key_1": "value of parameter",

    // your configured list of parameters
  }
}
```

Example

```json
"ISSUE_DOWNLOADED": {
  "templates": {
    "action": "issue_downloaded"
  },
  "parameters": {
    "issue_id": "{{ISSUE_ID}}",
    "issue_name": "{{ISSUE_NAME}}",
    "issue_categories": "{{ISSUE_CATEGORIES}}",
    "issue_tags": "{{ISSUE_TAGS}}",
    "issue_purchasable": "{{ISSUE_PURCHASABLE}}",
    "issue_purchased": "{{ISSUE_PURCHASED}}",
    "publication_id": "{{PUBLICATION_ID}}",
    "publication_name": "{{PUBLICATION_NAME}}"
  }
}
```
:::

### Views

:::CodeblockTabs
View event

```json
"view_event_key": {
  "templates": {
    "name": "value of template"
  }
}
```

Example

```json
"STOREFRONT_FEED": {
  "templates": {
    "name": "feed"
  }
}
```
:::

According to the official documentation, a manually triggered view event should be named “<font color="#ff6900">screen_view</font>”.&#x20;

*Purple implements this as follows:*

Every View event is sent using the name "<font color="#ff6900">screen_view</font>". The value of the "<font color="#2166ae">**name**</font>" template will be added as additional parameter value using the parameter key "<font color="#ff6900">screen_name</font>" to this view event. The parameter is added as follows:

**"**<font color="#ff6900">**screen_name**</font>**" : "**<font color="#3b9f0f">**value of name template**</font>**"**

### Purchases

Firebase does not support purchase events. All purchases are collected automatically. But this is restricted to purchases from the Apple App Store or the Google Play Store.

### Attributes

Firebase supports attributes.

:::CodeblockTabs
Attribute

```json
"attribute_key": {
  "templates": {
     "name": "value of template"
  }
}
```

Example

```json
"HAS_ACTIVE_SUBSCRIPTION": {
  "templates": {
    "name": "has_active_subscription"
  }
}
```
:::

Since Firebase Analytics does not support boolean attributes, these will be saved as string attributes. So the boolean value <font color="#2166ae">**true**</font> becomes the string "<font color="#2166ae">**true**</font>". The same behavior applies to boolean value <font color="#2166ae">**false**</font> which becomes "<font color="#2166ae">**false**</font>".

## Additional supported functionality

### Cloud Messaging

[https://firebase.google.com/docs/cloud-messaging](https://firebase.google.com/docs/cloud-messaging?hl=en)

This feature is enabled as provided by Firebase Cloud Messaging.

### Crashlytics

[https://firebase.google.com/docs/crashlytics](https://firebase.google.com/docs/crashlytics/?hl=en)

This feature is enabled as provided by Firebase Crashlytics.&#x20;

**Crash report enhancement**

To enhance this feature Purple adds some custom values to every crash report as follows to have a better determination of affected app versions:

| **Custom value**                             | **Description**                                                                                                                                                                                                                      |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <font color="#2166ae">**app_id**</font>      | The id of the app.                                                                                                                                                                                                                   |
| <font color="#2166ae">**app_version**</font> | The version of the app.                                                                                                                                                                                                              |
| <font color="#2166ae">**server**</font>      | The server base url.                                                                                                                                                                                                                 |
| <font color="#2166ae">**locale**</font>      | The first preferred language from the list of all preferred languages on that device. <br />The format is for example:<br />"<font color="#3b9f0f">de_DE</font>" for german or<br />"<font color="#3b9f0f">en_EN</font>" for english |
| <font color="#2166ae">**pk_version**</font>  | The version of the used PurpleKit.                                                                                                                                                                                                   |

### Dynamic links

[https://firebase.google.com/docs/dynamic-links](https://firebase.google.com/docs/dynamic-links?hl=en)

:::hint{type="danger"}
It is not recommended to use **Firebase DL** as it is deprecated and the service will be discontinued soon. There will be no replacement by Firebase itself.

Read more in the official documentation:
[https://firebase.google.com/support/dynamic-links-faq](https://firebase.google.com/support/dynamic-links-faq?hl=en)
:::

This feature is enabled as provided by Firebase Dynamic Links. Would you still like to find out more? Then read [Firebase Dynamic Links](docId\:UZdugswLxiHu5I0YsiZl2) in our documentation.

### In-App Messaging

[https://firebase.google.com/docs/in-app-messaging](https://firebase.google.com/docs/in-app-messaging?hl=en)&#x20;

This feature is enabled as provided by Firebase In-App Messaging.

### Debug Mode

[https://firebase.google.com/docs/analytics/debugview](https://firebase.google.com/docs/analytics/debugview?hl=en)

This feature is enabled as provided by Firebase and the debug mode is applied to preview builds only.

# How to configure

## Native Purple App

Any native Tracking Service is configured in the <font color="#2166ae">**Purple Manager.**</font>

### Enable SDK

:::hint{type="info"}
***Settings location***

"<font color="#2166ae">**Your app**</font>" => "<font color="#2166ae">**Consent/Push/Analytics**</font>" => "<font color="#2166ae">**Firebase Configuration** </font><font color="#2166ae">**(General/iOS/Android)**</font>"
:::

| **Setting**                       | **Description**                                                               |
| --------------------------------- | ----------------------------------------------------------------------------- |
| **Enable Firebase Analytics**     | To enable the Firebase Analytics SDK in your app, activate this checkbox.     |
| **Enable Firebase Crashlytics**   | To enable the Firebase Crashlytics SDK in your app, activate this checkbox.   |
| **Enable Firebase Dynamic Links** | To enable the Firebase Dynamic Links SDK in your app, activate this checkbox. |

Configuration settings are different by the used platform.

| **Setting (Android)**                | **Description**                                                                                                                                                                               |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Firebase configuration file**      | <font color="#2166ae">google-services.json</font><br />For a Firebase project within the Firebase console, you can download this configuration file.                                          |
| **Service Account Key**              | <font color="#2166ae">serviceAccountKey.json</font><br />For a Firebase project within the Firebase console, you can download this configuration file. This file is needed for push messages. |
| **Enable Firebase In-App Messaging** | To enable the Firebase In-App Messaging SDK in your app, activate this checkbox.                                                                                                              |

| **Setting (iOS)**                    | **Description**                                                                                                                                                               |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Firebase configuration file**      | <font color="#2166ae">GoogleService-Info.plist</font><br />For a Firebase project within the Firebase console, you can download this configuration file.                      |
| **Enable Firebase In-App Messaging** | To enable the Firebase In-App Messaging SDK in your app, activate this checkbox.                                                                                              |
| **Enable Firebase Cloud Messaging**  | To enable the Firebase Cloud Messaging SDK in your app, activate this checkbox.                                                                                               |
| **Enable Firebase Debug Mode**       | To enable the Firebase <font color="#ff6900">Debug Mode</font>, activate this checkbox. <br />The <font color="#ff6900">Debug Mode</font> is applied for preview builds only. |

### Apple privacy / ATT

:::hint{type="info"}
***Settings location***

"<font color="#2166ae">**Your app**</font>" => "<font color="#2166ae">**Consent/Push/Analytics**</font>" => "<font color="#2166ae">**Privacy**</font>"
:::

### Consent management

:::hint{type="info"}
**Settings location:**

"<font color="#2166ae">**Your app**</font>" => "<font color="#2166ae">**Consent/Push/Analytics**</font>" => "<font color="#2166ae">**Consent Management**</font>"
:::

| **Setting**                | **Description**                                               |
| -------------------------- | ------------------------------------------------------------- |
| **Vendor-ID for Firebase** | The Vendor-ID is provided by the consent management platform. |

## Web integration

Purple does not support Firebase web integration.
