Mobile

Setting up GA4 for your mobile app (it's all Firebase)

Learn how to configure Google Analytics 4 for iOS and Android apps using Firebase SDK. Step-by-step guide for cross-platform app analytics.

A
Antoine
January 14, 20266 min read

Here's the thing about GA4 for mobile apps: you don't set it up in GA4. You set it up in Firebase, and Firebase sends data to GA4.

Confusing? A little. But once you understand the connection, it makes sense. Let me walk you through it.

How GA4 mobile tracking works

Your App
    ↓
Firebase SDK (collects events)
    ↓
Firebase Console (manages project)
    ↓
GA4 Property (receives and reports data)

Firebase is Google's mobile platform. GA4 is the analytics layer. They're designed to work together, and you can't use GA4 for apps without Firebase.

Prerequisites

Before you start:

  • A Google/Firebase account
  • Your app's source code access
  • Android Studio (for Android) or Xcode (for iOS)
  • A GA4 property (or you'll create one)

Step 1: Create a Firebase project

  1. Go to console.firebase.google.com
  2. Click Add project
  3. Enter a project name (e.g., "My App")
  4. Enable Google Analytics when prompted
  5. Either:
    • Select an existing GA4 property to link
    • Create a new GA4 property
  6. Accept the terms and create the project

Important: Enable Google Analytics during setup. You can add it later, but it's easier to do it now.

Step 2: Register your app

For Android

  1. In Firebase Console, click Add app → Android
  2. Enter your package name (e.g., com.yourcompany.app)
  3. Optionally add a nickname and SHA-1
  4. Click Register app

For iOS

  1. In Firebase Console, click Add app → iOS
  2. Enter your bundle ID (e.g., com.yourcompany.app)
  3. Optionally add a nickname and App Store ID
  4. Click Register app

Step 3: Download configuration files

Firebase gives you a configuration file with your project credentials.

For Android

  1. Download google-services.json
  2. Add it to your app's app/ directory
  3. This file should be at app/google-services.json

For iOS

  1. Download GoogleService-Info.plist
  2. Add it to your Xcode project
  3. Make sure it's included in the target

Step 4: Add Firebase SDK

For Android (Gradle)

In your project-level build.gradle:

buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.4.0'
    }
}

In your app-level build.gradle:

plugins {
    id 'com.google.gms.google-services'
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:32.7.0')
    implementation 'com.google.firebase:firebase-analytics'
}

Sync your project.

For iOS (CocoaPods)

In your Podfile:

pod 'FirebaseAnalytics'

Run pod install in Terminal.

In your AppDelegate.swift:

import FirebaseCore

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

Step 5: Verify the link to GA4

  1. Go to your Firebase Console → Project settings → Integrations
  2. Find the Google Analytics card
  3. Confirm your GA4 property is linked

If it's not linked:

  1. Click Link on the Google Analytics card
  2. Select your GA4 account and property
  3. Complete the linking

Automatic events

Firebase SDK automatically tracks common mobile events:

EventWhat it tracks
first_openFirst time app is opened
session_startSession begins
screen_viewScreen/page views
app_updateApp version updates
app_removeApp uninstalls (Android)
os_updateOS updates
app_clear_dataUser clears app data

You don't need to add any code for these because they happen automatically.

Logging custom events

For business-specific tracking, log custom events:

Android (Kotlin)

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

val firebaseAnalytics = Firebase.analytics

// Log event
firebaseAnalytics.logEvent("add_to_cart") {
    param("item_id", "SKU_12345")
    param("item_name", "Premium T-Shirt")
    param("price", 24.99)
}

iOS (Swift)

import FirebaseAnalytics

Analytics.logEvent("add_to_cart", parameters: [
    "item_id": "SKU_12345",
    "item_name": "Premium T-Shirt",
    "price": 24.99
])

Setting up screen tracking

For accurate screen/page tracking, log screen views:

Android

firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW) {
    param(FirebaseAnalytics.Param.SCREEN_NAME, "Home Screen")
    param(FirebaseAnalytics.Param.SCREEN_CLASS, "HomeFragment")
}

iOS

Analytics.logEvent(AnalyticsEventScreenView, parameters: [
    AnalyticsParameterScreenName: "Home Screen",
    AnalyticsParameterScreenClass: "HomeViewController"
])

Testing your implementation

Debug mode (Android)

Enable debug mode via ADB:

adb shell setprop debug.firebase.analytics.app your.package.name

Disable when done:

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

Debug mode (iOS)

Add -FIRAnalyticsDebugEnabled to your Xcode scheme:

  1. Product → Scheme → Edit Scheme
  2. Arguments → Arguments Passed on Launch
  3. Add -FIRAnalyticsDebugEnabled

View debug data

  1. Go to GA4 → Admin → DebugView
  2. Run your app with debug mode enabled
  3. Watch events appear in real-time

Viewing data in GA4

Once Firebase is sending data:

  1. Go to your GA4 property
  2. Reports → Realtime for immediate data
  3. Reports → Engagement for app engagement
  4. Reports → Tech details for device/OS breakdown

Standard reports may take 24-48 hours to populate. Realtime shows data within minutes.

Combining web and app data

The best part of GA4: you can see web and app users together.

If you have a website with the same GA4 property:

  • Create a web data stream
  • Keep your app data streams
  • All data appears in the same property
GA4 Property: "My Product"
  └── Web Stream: mysite.com
  └── iOS Stream: My App iOS
  └── Android Stream: My App Android

User journeys across platforms become visible.

Common issues

Data not appearing

  1. Wait at least 24 hours for standard reports
  2. Check Realtime report first
  3. Verify Firebase is linked to correct GA4 property
  4. Confirm google-services.json or GoogleService-Info.plist is correct

Wrong property linked

  1. Go to Firebase Console → Project settings → Integrations
  2. Unlink the wrong property
  3. Link the correct GA4 property

Events not logging

  1. Enable debug mode
  2. Check DebugView in GA4
  3. Verify Firebase SDK is initialized before logging events
  4. Check for typos in event/parameter names

Next steps

Once basic tracking works:

  1. Set up key events for important app actions
  2. Configure user properties for segmentation
  3. Link to Google Ads for app campaign tracking

If you want a simpler way to view your app analytics alongside web data, try Analayer. We make cross-platform analytics actually understandable.

See your analytics clearly

Stop struggling with Google Analytics. Connect your account and get a cleaner, simpler view of your data in seconds.