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.
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
- Go to console.firebase.google.com
- Click Add project
- Enter a project name (e.g., "My App")
- Enable Google Analytics when prompted
- Either:
- Select an existing GA4 property to link
- Create a new GA4 property
- 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
- In Firebase Console, click Add app → Android
- Enter your package name (e.g.,
com.yourcompany.app) - Optionally add a nickname and SHA-1
- Click Register app
For iOS
- In Firebase Console, click Add app → iOS
- Enter your bundle ID (e.g.,
com.yourcompany.app) - Optionally add a nickname and App Store ID
- Click Register app
Step 3: Download configuration files
Firebase gives you a configuration file with your project credentials.
For Android
- Download google-services.json
- Add it to your app's
app/directory - This file should be at
app/google-services.json
For iOS
- Download GoogleService-Info.plist
- Add it to your Xcode project
- 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
- Go to your Firebase Console → Project settings → Integrations
- Find the Google Analytics card
- Confirm your GA4 property is linked
If it's not linked:
- Click Link on the Google Analytics card
- Select your GA4 account and property
- Complete the linking
Automatic events
Firebase SDK automatically tracks common mobile events:
| Event | What it tracks |
|---|---|
first_open | First time app is opened |
session_start | Session begins |
screen_view | Screen/page views |
app_update | App version updates |
app_remove | App uninstalls (Android) |
os_update | OS updates |
app_clear_data | User 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:
- Product → Scheme → Edit Scheme
- Arguments → Arguments Passed on Launch
- Add
-FIRAnalyticsDebugEnabled
View debug data
- Go to GA4 → Admin → DebugView
- Run your app with debug mode enabled
- Watch events appear in real-time
Viewing data in GA4
Once Firebase is sending data:
- Go to your GA4 property
- Reports → Realtime for immediate data
- Reports → Engagement for app engagement
- 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
- Wait at least 24 hours for standard reports
- Check Realtime report first
- Verify Firebase is linked to correct GA4 property
- Confirm
google-services.jsonorGoogleService-Info.plistis correct
Wrong property linked
- Go to Firebase Console → Project settings → Integrations
- Unlink the wrong property
- Link the correct GA4 property
Events not logging
- Enable debug mode
- Check DebugView in GA4
- Verify Firebase SDK is initialized before logging events
- Check for typos in event/parameter names
Next steps
Once basic tracking works:
- Set up key events for important app actions
- Configure user properties for segmentation
- 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.