Skip to main content
Google Firebase Analytics provides insights into user behavior within your app, helping you understand how users engage and interact. It offers essential app metrics such as average revenue per user (ARPU), active users, retention reports, and event counts, along with detailed user properties like device type, app version, and OS version. By combining these data points, Firebase Analytics enables data-driven decision-making to optimize app performance and user experience.

Why use Google Firebase Analytics?

  • Real-time insights: User behavior tracking and integration with other Firebase services.
  • Essential metrics: ARPU, active users, retention, event counts, device type, app version, OS version.
  • Consent management: Configure ad storage, analytics storage, ad user data, and ad personalization at runtime.
  • JavaScript Bridge: Enable/disable logging, set user ID and properties, log custom events and screen views, and use e-commerce events.

Prerequisites

  • A Median app with the JavaScript Bridge enabled
  • A Google Firebase project (Firebase Console)
  • Android Package Name (from Median App Studio > Build & Deploy > App Identifiers) for Android
  • Apple Bundle ID (from App Studio > Build & Deploy > App Identifiers) for iOS
  • google-services.json (Android) and GoogleService-Info.plist (iOS) from Firebase after app registration
  • Plugin enabled in App Studio (Native Plugins > Google Firebase Analytics)

Implementation guide

Google Firebase project setup

If you do not have an active Google Firebase project, you may need to create a new project after signing into your Google Firebase Account. Once your project is set up, you can start the integration by choosing either the iOS or Android logo in your Project Overview screen.
Firebase Project Overview screen with iOS and Android app options

Google Firebase project overview

Register your Android app in Firebase

Provide the Android Package Name (found in Median App Studio under Build & Deploy > App Identifiers). See App identifiers. Register your Android app Once registered, download google-services.json for the App Configuration step. You do not need to add the Firebase SDK manually; the plugin performs that step. Download the google-services.json configuration file

Register your iOS app in Firebase

Provide the Apple Bundle ID (found in App Studio under Build & Deploy > App Identifiers). See App identifiers. Register your iOS app Once registered, download GoogleService-Info.plist for the App Configuration step. You do not need to add the Firebase SDK or initialization code; the plugin performs those steps. Download the GoogleService-Info.plist configuration file

Enable the plugin

  1. Google Services configuration: Upload GoogleService-Info.plist (iOS) and google-services.json (Android) in Build & Deploy > Google Services in App Studio. You can upload files from Firebase or copy and paste their contents.
  2. Consent configuration: In Plugin Settings, set your default consent value: Follow EU Consent Policy (deny for users in regions subject to the EU User Consent Policy), Deny (deny consent), or Allow (grant consent).
  3. Plugin activation: Enable the plugin in App Studio via Native Plugins > Google Firebase Analytics > Settings.

Finalizing the app build

Once you upload the configuration files, save the changes and rebuild your app. Upload your GoogleService-Info.plist and google-services.json configurations

Use your AI agent

Use the Median MCP with your AI agent to enable Firebase Analytics and add your Firebase configuration files to your mobile app. See Median MCP server to set it up.

JavaScript Bridge functions

Configure consent for ad storage, analytics storage, ad user data, and ad personalization at runtime.
Parameters:

Analytics management

Enable or disable all event logging (including automatic app events). Logging is enabled by default. Effect is persistent; once disabled, re-enable by calling again with true.
Parameters:

User management

Set a custom user ID (for example, after sign-in when the user is no longer anonymous).
Parameters:

Set user property

Associate additional properties with the user.
Parameters:

Event logging

Set default event parameters logged alongside other information for log event.
Parameters:

Log event

Log a custom event. The data object is flexible.
Parameters:

Log screen

Log a customized screen view event (in addition to default logging).
Parameters:

E-commerce events

Firebase offers a special command set that is tailored for e-commerce integrations. You can learn more about the commands in the Firebase Measure e-commerce documentation. Log item views
Log wishlist additions
Log add to cart events
Log remove from cart events
Note: ProductItem may include the following fields. All fields are optional though it is recommended to provide at least an item_id or item_name.

Default event logging

By default, Firebase Analytics automatically logs key events such as screen_view, session_start, and first_open_time. For a complete list of automatic events, see Google Analytics documentation.

Testing checklist

Basic functionality
  • Plugin is enabled in App Studio (Native Plugins > Google Firebase Analytics > Settings)
  • google-services.json (Android) and GoogleService-Info.plist (iOS) are uploaded in Build & Deploy > Google Services
  • App rebuilt after configuration changes
  • Firebase Analytics initializes without JavaScript Bridge errors
Platform testing
  • median.firebaseAnalytics.event.setConsent(...) behaves as expected for your test scenario
  • median.firebaseAnalytics.event.collection({'enabled': false}) then true changes logging behavior
Configuration testing
  • Default consent option in Plugin Settings matches your policy (Follow EU Consent Policy, Deny, or Allow)
  • setUser, setUserProperty, logEvent, logScreen, and e-commerce calls appear in Firebase Analytics as expected
User experience
  • Consent and analytics behavior align with your privacy disclosures
  • Custom events and screen views do not block core web flows

Troubleshooting

Firebase Analytics functions are undefined or not working

Enable the JavaScript Bridge in App Studio, then call Firebase methods after the median_library_ready() event. In App Studio (Native Plugins > Google Firebase Analytics), confirm the plugin is enabled and that GoogleService-Info.plist (iOS) and google-services.json (Android) are uploaded under Build & Deploy > Google Services. Save and rebuild after configuration changes.

Custom events are not appearing in Firebase Analytics

Verify event collection is enabled with median.firebaseAnalytics.event.collection({'enabled': true}). Then trigger a known test event, for example median.firebaseAnalytics.event.logEvent({'event': 'test_event', 'data': {...}}), and confirm your app build includes the latest plugin and Google Services configuration files. Check the default consent option in Plugin Settings (Follow EU Consent Policy, Deny, or Allow) and confirm you are not overriding it unexpectedly at runtime. If you call setConsent, verify each key (adStorage, analyticsStorage, adUserData, adPersonalization) is set to the intended boolean value.

User ID or user properties are missing from analytics data

Set the user ID only after the user is authenticated using median.firebaseAnalytics.event.setUser({'ID': 'your_user_id'}), then apply properties with setUserProperty. Trigger a follow-up event after those calls so the updated identity and properties are attached to event data.

E-commerce events are incomplete or rejected

Confirm your e-commerce payload includes valid currency (3-letter uppercase code), numeric price, and quantity where required. For data, include a valid ProductItem map and provide at least item_id or item_name to improve event quality and reporting reliability.
Still having trouble?For Firebase Analytics behavior outside Median’s bridge, refer to the Google Firebase Analytics documentation.
Last modified on December 3, 2026