What Is Firebase?

Firebase is a comprehensive app development platform developed by Google that provides a suite of tools and services to help developers build, improve, and grow their applications. It offers functionalities like real-time database, authentication, cloud storage, analytics, and machine learning. Firebase is known for its ease of integration, scalability, and the ability to synchronize data across multiple clients in real-time. It supports both mobile and web applications, making it a versatile choice for developers.

What are the benefits of integrating MetaRouter with Firebase?

Firebase offers an “add-on” experience for MetaRouter’s integration with Google Analytics 4, enhancing both app and web analytics capabilities. A few benefits of the integration include:

  • Unified Data View: Gain a comprehensive understanding of user journeys across web and mobile platforms.
  • Advanced Reporting: Benefit from GA4's enhanced event-based tracking and detailed analysis.
  • Cross-Platform Insights: Identify user interactions across different devices and channels for optimized experiences.
  • Improved Attribution: Leverage advanced attribution models to better assess marketing channel effectiveness.

Getting Started - Prerequisites

  1. You must have Google Analytics 4 integrated with MetaRouter.

  2. You must have GTAG sync integrated with Metarouter.

  3. You must have the Firebase SDK installed in your apps.

    1. Get started with Google Analytics - Firebase Firebase provides a general guide on adding the Analytics SDK to your app, which is necessary for collecting data that will be transferred to GA4.
  4. You must have Firebase and Google Analytics 4 connected.

    1. [GA4] Firebase integration - Analytics Help Google Support explains the steps to set up a new Analytics link between your Firebase project and a GA4 property.
  5. You will need to grab the following tokens and IDs for the Firebase starter kit.

    1. API Secret

      1. To create a new secret, navigate in the Google Analytics UI to:

      Admin > Data Streams > choose your stream > Measurement Protocol > Create

      We recommend that you keep these private to your organization. If you deploy the measurement protocol client-side, you should regularly rotate api_secrets to avoid excessive SPAM.

      Important:

      • This API Secret is confidential. Do not share it publicly or embed it in client-side code.
      • You'll use this API Secret when constructing the request to send data to your GA4 data stream using the Measurement Protocol.
      • The API secret itself grants access to send data to all data streams in your GA4 property.
    2. Firebase App ID

      1. Go to the Firebase console (https://console.firebase.google.com/).
      2. Click on the project you want to find the App ID for.
      3. Click on "Project settings" in the left sidebar.
      4. Scroll down to the "Your apps" card.
      5. Click on the desired Firebase app (if you have multiple).
      6. The App ID will be displayed on the app information page.

Getting Started - From Your MetaRouter Account

NOTE: Please be sure to follow the prerequisites above prior to integrating with Firebase.

Adding a Firebase integration.

From the integration library, add a Firebase integration. Then, fill out the Connection Parameters:

Connection ParameterDescription
API_SECRETEach data stream has a unique API Secret for sending data via GA4 Measurement Protocol.
FIREBASE_APP_IDA Firebase App ID is a unique identifier for your app within the Firebase platform.

Event Mappings

MetaRouter provides all of the event mappings that Firebase’s integration typically require. You may add custom events, parameters or mappings in accordance with Firebase’s API documentation.

Global

Global mappings will be applied to all events. If your parameter names do not match the Expected Inputs provided, you will need to overwrite the Inputs provided with your own.

Output KeyDescriptionExpected Input
app_instance_id RequiredString: A unique identifier for a Firebase app instance must be fetched via the Firebase SDK. This is different than a web client_id.context.providers.googleFirebase.appInstanceId
non_personalized_adsBoolean: Parameter in Firebase Analytics allows developers to serve ads that are not based on user behavior data. When this parameter is set to true, ads are targeted using contextual information rather than user-specific data, ensuring compliance with user privacy preferences and regulations, such as GDPR.context.providers.googleFirebase.nonPersonalizedAds

Event Specific:

Order Completed, Cart Viewed, Product List Viewed, Checkout Started, Product Added, Product Viewed, Products Searched

Output KeyDescriptionExpected Input
events
Required
Array of Objects: Represents an array of event objects, each containing details such as the event name and associated parameters, to be logged in Firebase Analytics.N/A - Expression

Required & Recommended Identifiers

These identifiers must be mapped to Firebase in order for successful user matching to occur. Without these IDs, any events sent to Firebase will be rejected. For your convenience, required and recommended IDs are mapped as Global parameters to ensure they are added to every event.

AttributeExampleSync Injector Required?
app_instance_id
Required
cHJvZHVjdF9pZD1maXJlYmFzZToyMDE2MTA1OCZhcHBfaW...Yes

Additional Identifiers

These identifiers should be mapped to Firebase whenever possible to ensure the highest user match rates possible. If using these identifiers, they must be added as Global or Event Specific mappings.

AttributeDescriptionExample
user_idA unique identifier for a user. See User-ID for cross-platform analysis for more information on this identifier. Note: user_id may only contain utf-8 characters.user_12345_abcXYZ

Additional Firebase Documentation