Stay organized with collections
Save and categorize content based on your preferences.
Google Analytics tracks screen transitions and attaches information
about the current screen to events, enabling you to track metrics such as user
engagement or user behavior per screen. Much of this data collection happens
automatically, but you can also manually log screenviews. Manually tracking
screens is useful if your app does not use a separate UIViewController,
View, or Activity for each screen you may wish to track, such as in a game.
Automatically track screens
Analytics automatically tracks some information about screens in your
application, such as the class name of the UIViewController or Activity that
is currently in focus. When a screen transition occurs, Analytics logs a
screen_view event that identifies the new screen. Events that occur on these
screens are automatically tagged with the parameter firebase_screen_class (for
example, menuViewController or MenuActivity) and a generated
firebase_screen_id. If your app uses a distinct UIViewController or
Activity for each screen, Analytics can automatically track every screen
transition and generate a report of user engagement broken down by screen. If
your app doesn't, you can still get these reports by manually logging
screen_view events.
Disable screenview tracking
Automatic screenview reporting can be turned off on iOS by setting
FirebaseAutomaticScreenReportingEnabled to NO (Boolean) in the Info.plist.
And on Android, nest the following setting within the <application> tag of the
AndroidManifest.xml file:
You can manually log screen_view events whether or not automatic tracking is
enabled. You can log these events in the onAppear or viewDidAppear methods
for Apple platforms and onResume for Android. When screen_class is not set,
Analytics sets a default value based on the UIViewController or Activity
that is in focus when the call is made.
If you've disabled swizzling in your app, all screen names must be set manually.
For SwiftUI users, use the AnalyticsSwift extension SDK.
Swift
Note: This Firebase product is not available on the macOS target.
[null,null,["Last updated 2025-08-15 UTC."],[],[],null,["Google Analytics tracks screen transitions and attaches information\nabout the current screen to events, enabling you to track metrics such as user\nengagement or user behavior per screen. Much of this data collection happens\nautomatically, but you can also manually log screenviews. Manually tracking\nscreens is useful if your app does not use a separate `UIViewController`,\n`View`, or `Activity` for each screen you may wish to track, such as in a game.\n\nAutomatically track screens\n\nAnalytics automatically tracks some information about screens in your\napplication, such as the class name of the `UIViewController` or `Activity` that\nis currently in focus. When a screen transition occurs, Analytics logs a\n`screen_view` event that identifies the new screen. Events that occur on these\nscreens are automatically tagged with the parameter `firebase_screen_class` (for\nexample, `menuViewController` or `MenuActivity`) and a generated\n`firebase_screen_id`. If your app uses a distinct `UIViewController` or\n`Activity` for each screen, Analytics can automatically track every screen\ntransition and generate a report of user engagement broken down by screen. If\nyour app doesn't, you can still get these reports by manually logging\n`screen_view` events.\n| **Note:** On Apple platforms, Firebase depends on method swizzling to automatically log screen views. SwiftUI apps must manually set screen names for views that should be logged via the `FirebaseAnalyticsSwift` module, or log screen views manually (see below).\n\nDisable screenview tracking\n\nAutomatic screenview reporting can be turned off on iOS by setting\n`FirebaseAutomaticScreenReportingEnabled` to `NO` (Boolean) in the Info.plist.\n\nAnd on Android, nest the following setting within the `\u003capplication\u003e` tag of the\n`AndroidManifest.xml` file: \n\n \u003cmeta-data android:name=\"google_analytics_automatic_screen_reporting_enabled\" android:value=\"false\" /\u003e\n\nManually track screens\n\nYou can manually log `screen_view` events whether or not automatic tracking is\nenabled. You can log these events in the `onAppear` or `viewDidAppear` methods\nfor Apple platforms and `onResume` for Android. When `screen_class` is not set,\nAnalytics sets a default value based on the UIViewController or Activity\nthat is in focus when the call is made.\n\nIf you've disabled swizzling in your app, all screen names must be set manually.\nFor SwiftUI users, use the Analytics\n[Swift extension SDK](//github.com/firebase/firebase-ios-sdk/tree/master/FirebaseAnalyticsSwift#firebase-analytics-swift-sdk). \n\nSwift\n\n\n**Note:** This Firebase product is not available on the macOS target. \n\n```swift\nAnalytics.logEvent(AnalyticsEventScreenView,\n parameters: [AnalyticsParameterScreenName: screenName,\n AnalyticsParameterScreenClass: screenClass])https://github.com/firebase/quickstart-ios/blob/6e483be884a13ffe8d6258f1a626662fa9e7d837/analytics/LegacyAnalyticsQuickstart/AnalyticsExampleSwift/ViewController.swift#L44-L46\n```\n\nObjective-C\n\n\n**Note:** This Firebase product is not available on the macOS target. \n\n```objective-c\n[FIRAnalytics logEventWithName:kFIREventScreenView\n parameters:@{kFIRParameterScreenClass: screenClass,\n kFIRParameterScreenName: screenName}];https://github.com/firebase/quickstart-ios/blob/6e483be884a13ffe8d6258f1a626662fa9e7d837/analytics/LegacyAnalyticsQuickstart/AnalyticsExample/ViewController.m#L49-L51\n```\n\nKotlin \n\n```kotlin\nfirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW) {\n param(FirebaseAnalytics.Param.SCREEN_NAME, screenName)\n param(FirebaseAnalytics.Param.SCREEN_CLASS, \"MainActivity\")\n}https://github.com/firebase/snippets-android/blob/391c1646eacf44d2aab3f76bcfa60dfc6c14acf1/analytics/app/src/main/java/com/google/firebase/example/analytics/kotlin/MainActivity.kt#L249-L252\n```\n\nJava \n\n```java\nBundle bundle = new Bundle();\nbundle.putString(FirebaseAnalytics.Param.SCREEN_NAME, screenName);\nbundle.putString(FirebaseAnalytics.Param.SCREEN_CLASS, \"MainActivity\");\nmFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW, bundle);https://github.com/firebase/snippets-android/blob/391c1646eacf44d2aab3f76bcfa60dfc6c14acf1/analytics/app/src/main/java/com/google/firebase/example/analytics/MainActivity.java#L314-L317\n```\n\nWeb \n\n```javascript\nimport { getAnalytics, logEvent } from \"firebase/analytics\";\n\nconst analytics = getAnalytics();\nlogEvent(analytics, 'screen_view', {\n firebase_screen: screenName, \n firebase_screen_class: screenClass\n});https://github.com/firebase/snippets-web/blob/467eaa165dcbd9b3ab15711e76fa52237ba37f8b/snippets/analytics-next/index/analytics_record_screen_view.js#L8-L14\n```\n\nWeb \n\n```javascript\nfirebase.analytics().logEvent('screen_view', {\n firebase_screen: screenName, \n firebase_screen_class: screenClass\n});https://github.com/firebase/snippets-web/blob/467eaa165dcbd9b3ab15711e76fa52237ba37f8b/analytics/index.js#L47-L50\n```\n\nDart \n\n await FirebaseAnalytics.instance.logEvent(\n name: 'screen_view',\n parameters: {\n 'firebase_screen': screenName,\n 'firebase_screen_class': screenClass,\n },\n );"]]