Firebase Analytics setup guide for mobile apps showing SDK integration and GA4 connection

Firebase Analytics Setup Guide for Mobile Apps: Proven Steps (2026)

If you build a mobile app and do not track what users do inside it, you are guessing. Google Analytics for Firebase is free, works on iOS and Android, and sends your app data into Google Analytics 4 (GA4). Installing it is easy. Setting it up so the data is clean and usable is where most teams struggle.

This guide walks through the full firebase analytics setup for mobile apps: creating the project, installing the SDK, custom events, user properties, GA4, validation and BigQuery. It follows the current Firebase and Google Analytics documentation as of October 2026.

In this guide you will learn:

  • What Firebase Analytics is and why it matters
  • How to add Firebase to an iOS and Android app
  • How to log custom events and set user properties
  • How to confirm the GA4 link
  • How to validate your tracking with DebugView
  • The most common Firebase Analytics mistakes and how to fix them

What Is Firebase Analytics and Why It Matters

Firebase Analytics (officially Google Analytics for Firebase) is Google’s free app measurement SDK. It collects user behavior from your app and reports it in your GA4 property and in the Firebase console.

Why teams use it

  • Free to use on both iOS and Android
  • Collects key events automatically, such as first_open, session_start and screen_view
  • Connects to GA4, BigQuery and Google Ads
  • Supports user properties, audiences and funnel analysis

For many app teams, Firebase is the base analytics layer. Tools such as AppsFlyer, Adjust or RevenueCat sit next to it for install attribution and revenue, which I cover near the end of this guide.

How Firebase Analytics Works

You add the Firebase SDK to your app. After that, it does the following:

  1. Collects predefined events automatically
  2. Sends events to your linked GA4 property
  3. Shows the data in the Firebase console and in GA4 reports
  4. Lets you log custom events and set user properties through SDK calls
  5. Optionally exports raw events to BigQuery

Data flow:

App with Firebase SDK → GA4 property → Firebase console and GA4 reports → optional BigQuery export

Firebase Analytics Setup for Mobile Apps: What You Need First

Check these requirements before you start. They come from the current Firebase setup guides:

  • Android: target API level 24 (Android 7.0) or higher, AndroidX, and Android Gradle plugin 7.3.0 or later
  • iOS: iOS 15 or later, and a recent Xcode (the current guide asks for Xcode 26.2 or later)
  • A Google account with access to the Firebase console
  • A GA4 property, or permission to create one

Requirements change with releases, so confirm them in the official Android setup guide and iOS setup guide before you update a production app.

Step 1: Create a Firebase Project

You need a Firebase project before you install anything.

  1. Open the Firebase console and create a new project
  2. Give it a clear name, for example MyApp-Production
  3. Keep Google Analytics enabled for the project
  4. Select an existing GA4 property or create a new one
  5. Finish creating the project

Important: use separate Firebase projects for development and production. If test events land in your production property, they mix with real user data and are hard to separate later.

Step 2: Add Your App to Firebase

Android

  1. In the Firebase console, click Add app and choose Android
  2. Enter your package name, for example com.yourcompany.appname
  3. Download google-services.json
  4. Place it in your app module directory (usually /app)
  5. Add the Google services plugin and the Firebase libraries in Gradle

Project-level build.gradle.kts (keep your existing plugin lines and add the last one):

plugins {
    // your existing plugins stay here
    id("com.google.gms.google-services") version "4.5.0" apply false
}

App-level build.gradle.kts:

plugins {
    id("com.android.application")
    id("com.google.gms.google-services")
}

dependencies {
    implementation(platform("com.google.firebase:firebase-bom:35.1.0"))
    implementation("com.google.firebase:firebase-analytics")
}

If your project still uses Groovy build.gradle files, the same lines use single quotes, for example id 'com.google.gms.google-services' version '4.5.0' apply false and implementation platform('com.google.firebase:firebase-bom:35.1.0').

You do not set a version on firebase-analytics because the BoM manages it. Version numbers move quickly, so check the Android setup guide for the current ones. Kotlin developers no longer need the KTX modules and should use the main modules, as shown above.

iOS

  1. In the Firebase console, click Add app and choose iOS
  2. Enter your bundle ID exactly as it appears in Xcode (it is case-sensitive and cannot be changed later)
  3. Download GoogleService-Info.plist
  4. Move it into the root of your Xcode project and add it to all targets if Xcode asks
  5. Add the SDK with Swift Package Manager

In Xcode, choose File, then Add Packages. Enter https://github.com/firebase/firebase-ios-sdk, keep the recommended version rule, and select FirebaseAnalytics.

Do not start a new project on CocoaPods. According to Firebase’s CocoaPods notice, Firebase stops publishing new versions to CocoaPods in October 2026, and the CocoaPods registry becomes read-only in December 2026. Existing versions keep working, but new Firebase releases will not reach CocoaPods. If you already have a Podfile, plan the move to Swift Package Manager and do not mix both methods in the same target.

Step 3: Initialize Firebase in Your App

Android (Kotlin)

On Android, Firebase starts through the Google services plugin. You only need the Analytics instance when you log events yourself:

import com.google.firebase.Firebase
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.analytics

class MainActivity : AppCompatActivity() {
    private lateinit var analytics: FirebaseAnalytics

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        analytics = Firebase.analytics
    }
}

iOS (SwiftUI)

Firebase’s iOS guide uses an app delegate attached to your App struct:

import SwiftUI
import FirebaseCore

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
        FirebaseApp.configure()
        return true
    }
}

@main
struct MyApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

Once Firebase is configured, automatic events start collecting without extra code.

Step 4: Configure Events

Events collected automatically

These need no code once the SDK is installed. See Google’s list of automatically collected events for the full set.

EventWhen it fires
first_openFirst launch after install or reinstall
session_startA user engages the app and a session begins
screen_viewThe screen name, class or ID changes from the previous one
user_engagementThe app is in the foreground for at least one second
app_updateThe app is updated and relaunched
os_updateThe device operating system is updated
in_app_purchaseA store purchase completes (needs the Firebase SDK)

Some events are platform specific. For example, app_remove and app_clear_data are Android only.

Log custom events

Automatic events are not enough for real insight. Log the actions that matter to your business.

Android (Kotlin):

// User signs up
val signUp = Bundle()
signUp.putString(FirebaseAnalytics.Param.METHOD, "email")
analytics.logEvent(FirebaseAnalytics.Event.SIGN_UP, signUp)

// Purchase
val purchase = Bundle()
purchase.putDouble(FirebaseAnalytics.Param.VALUE, 29.99)
purchase.putString(FirebaseAnalytics.Param.CURRENCY, "USD")
purchase.putString(FirebaseAnalytics.Param.TRANSACTION_ID, "txn_12345")
analytics.logEvent(FirebaseAnalytics.Event.PURCHASE, purchase)

// Custom event
val custom = Bundle()
custom.putString("plan_type", "premium")
custom.putString("source", "onboarding")
analytics.logEvent("subscription_started", custom)

iOS (Swift):

import FirebaseAnalytics

// User signs up
Analytics.logEvent(AnalyticsEventSignUp, parameters: [
    AnalyticsParameterMethod: "email"
])

// Purchase
Analytics.logEvent(AnalyticsEventPurchase, parameters: [
    AnalyticsParameterValue: 29.99,
    AnalyticsParameterCurrency: "USD",
    AnalyticsParameterTransactionID: "txn_12345"
])

// Custom event
Analytics.logEvent("subscription_started", parameters: [
    "plan_type": "premium",
    "source": "onboarding"
])

Event naming rules and limits

Google lists these in its event collection limits:

  • Event names can be up to 40 characters
  • Use letters, numbers and underscores, and do not start with a number
  • Avoid the reserved prefixes firebase_, google_ and ga_
  • Up to 500 distinctly named events per app (automatically collected events do not count)
  • Up to 25 parameters per event, with names up to 40 characters and values up to 100 characters

Step 5: Set User Properties and a User ID

User properties let you segment users by attributes such as plan type or language.

Android (Kotlin):

analytics.setUserProperty("subscription_type", "premium")
analytics.setUserProperty("user_tier", "enterprise")
analytics.setUserId("user_12345")

iOS (Swift):

Analytics.setUserProperty("premium", forName: "subscription_type")
Analytics.setUserProperty("enterprise", forName: "user_tier")
Analytics.setUserID("user_12345")

Limits to remember: 25 user properties per property, property names up to 24 characters, values up to 36 characters, and user IDs up to 256 characters.

Important: never send personally identifiable information such as an email address, phone number or full name as a user property, event parameter or user ID. Google Analytics terms prohibit it, and it creates GDPR risk. Use an internal anonymous ID instead.

Step 6: Confirm the GA4 Link

When you keep Google Analytics enabled in Step 1, your project is linked to a GA4 property from the start. If you skipped it, open Project settings in the Firebase console, go to Integrations, and link a GA4 property there.

Once linked:

  • Firebase events flow into GA4 automatically
  • You can build GA4 audiences from your app events
  • Google Ads can use those audiences for remarketing

To verify, open your GA4 property, go to Admin, then Data streams. You should see your iOS and Android app streams. Reports are not instant: according to Google’s data freshness guide, intraday data takes about 2 to 6 hours, daily data about 12 hours, and processing can take 24 to 48 hours.

Step 7: Validate Your Setup with DebugView

Never assume your tracking works. Test it before release with DebugView.

Android

adb shell setprop debug.firebase.analytics.app com.yourpackage.name

To turn it off again:

adb shell setprop debug.firebase.analytics.app .none.

iOS

In Xcode, edit your scheme and add this to Arguments Passed On Launch:

-FIRDebugEnabled

Use -FIRDebugDisabled to turn it off.

Where to look

In the Firebase console, open Analytics, then DebugView, and trigger events on your test device. You will see them arrive as they are sent.

Events sent in debug mode are included in the daily BigQuery export by default. To keep test traffic out of your reports and exports, set up a developer traffic data filter in your Analytics property.

Validation checklist

  • first_open fires on a fresh install
  • session_start fires when the app opens
  • Custom events appear in DebugView with the right parameters
  • User properties and the user ID are set correctly
  • No event is logged twice
  • Events reach GA4 reports after the normal processing time

Step 8: Export to BigQuery (Optional)

For advanced analysis, export raw Firebase data to BigQuery. Per Firebase’s BigQuery linking guide:

  1. Open Project settings in the Firebase console
  2. Go to the Integrations tab
  3. Click Link on the BigQuery card
  4. Choose the export options and the dataset region

What to know before you link:

  • A daily export fills a new table each day, and events also stream into a near real-time intraday table
  • Data from before you linked the project is not exported
  • The Google Analytics export is capped at 1 million events per day unless you use Google Analytics 360
  • The dataset region cannot be changed afterward
  • Storage, streaming inserts and queries are billed by BigQuery, and a free sandbox with limits is available

Common Firebase Analytics Mistakes

Mistake 1: Using one project for development and production

Test events mix with real data and are hard to remove later. Use separate Firebase projects, or at least filter developer traffic.

Mistake 2: Not setting a user ID

Without setUserId(), you cannot connect one person’s activity across sessions and devices. Set an anonymous ID right after login.

Mistake 3: Sending personal data in events

Emails, phone numbers and names do not belong in event parameters or user properties. Use anonymous IDs only.

Mistake 4: Creating too many custom event names

The limit is 500 distinct event names per app. Plan an event list first and use parameters instead of a new event for every small action.

Mistake 5: Skipping DebugView

Many teams ship events they never saw arrive. Validate each event in DebugView before release.

Mistake 6: Expecting instant reports

Realtime and DebugView are fast. Standard reports can take hours, and processing can take up to 48 hours. Do not change your setup just because yesterday’s numbers are still moving.

Mistake 7: Staying on CocoaPods

New Firebase releases stop reaching CocoaPods after October 2026. Move your iOS project to Swift Package Manager so you keep receiving SDK updates.

Firebase Analytics and Your Mobile Attribution Stack

Firebase alone does not tell you which ad or campaign brought each install. A complete measurement stack usually combines several tools:

ToolPurpose
Firebase AnalyticsIn-app behavior tracking
AppsFlyer, Adjust, Branch or SingularInstall attribution and campaign tracking
RevenueCatSubscription and revenue tracking
Amplitude, Mixpanel or PostHogProduct analytics
GA4Cross-platform reporting

If you are choosing an attribution tool, read my AppsFlyer vs Adjust comparison. To set one up, follow the AppsFlyer setup guide. If the basics are new to you, start with what mobile attribution is. To inspect the payloads these tools send, use the free mobile attribution debugger.

FAQ

What is Firebase Analytics used for in mobile apps?

Firebase Analytics, now called Google Analytics for Firebase, tracks what users do inside your iOS and Android app. It records automatic events such as first_open and session_start, plus custom events like sign-ups and purchases, and reports them in your GA4 property and the Firebase console.

Is Firebase Analytics free?

Yes, Google Analytics for Firebase is free to use. Costs can appear on other Google services you link to it, such as BigQuery storage, streaming inserts and queries beyond the free sandbox.

How long does Firebase Analytics data take to appear?

DebugView and the Realtime report show events within minutes. Standard GA4 reports are slower: intraday data takes about 2 to 6 hours, daily data about 12 hours, and processing can take up to 24 to 48 hours, during which numbers may still change.

Can I use Firebase Analytics with AppsFlyer or Adjust?

Yes. Firebase tracks in-app behavior, while AppsFlyer or Adjust handles install attribution and campaign data. Teams commonly run them side by side. Check each platform’s integration guide if you want to pass data between them.

What is the difference between Firebase Analytics and GA4?

Firebase Analytics is the SDK in your app and the reports inside the Firebase console. GA4 is the Google Analytics property where the same app data is stored and analyzed. Once your Firebase project is linked to a GA4 property, both show the same events.

How do I track purchases in Firebase Analytics?

Log the standard purchase event with the value, currency and transaction_id parameters. GA4 recognizes this event name. Store purchases made through the App Store or Google Play are also collected automatically as in_app_purchase when the Firebase SDK is installed.

How do I turn on DebugView?

On Android, run adb shell setprop debug.firebase.analytics.app with your package name. On iOS, add -FIRDebugEnabled to the Arguments Passed On Launch in your Xcode scheme. Then open Analytics and DebugView in the Firebase console.

Should I use CocoaPods or Swift Package Manager for Firebase on iOS?

Use Swift Package Manager. According to Firebase, it stops publishing new versions to CocoaPods in October 2026 and the CocoaPods registry becomes read-only in December 2026. Existing versions keep working, but new Firebase releases will not reach CocoaPods.

Conclusion

A clean firebase analytics setup for mobile apps comes down to a few habits: separate projects for testing and production, a short and deliberate event list, no personal data, validation in DebugView before every release, and Swift Package Manager on iOS. Get those right and your GA4 data will be something you can trust.

If your events still do not match across Firebase, GA4 and your attribution tool, email the details to contact@alfahadhridoy.com and I will review them in writing.