Measure screenviews

Google Analytics tracks screen transitions and attaches informationabout the current screen to events, enabling you to track metrics such as userengagement or user behavior per screen. Much of this data collection happensautomatically, but you can also manually log screenviews. Manually trackingscreens is useful if your app does not use a separateUIViewController,View, orActivity for each screen you may wish to track, such as in a game.

Automatically track screens

Analytics automatically tracks some information about screens in yourapplication, such as the class name of theUIViewController orActivity thatis currently in focus. When a screen transition occurs,Analytics logs ascreen_view event that identifies the new screen. Events that occur on thesescreens are automatically tagged with the parameterfirebase_screen_class (forexample,menuViewController orMenuActivity) and a generatedfirebase_screen_id. If your app uses a distinctUIViewController orActivity for each screen,Analytics can automatically track every screentransition and generate a report of user engagement broken down by screen. Ifyour app doesn't, you can still get these reports by manually loggingscreen_view events.

Note: On Apple platforms, Firebase depends on method swizzling to automaticallylog screen views. SwiftUI apps must manually set screen names for views thatshould be logged via theFirebaseAnalyticsSwift module, or log screen viewsmanually (see below).

Disable screenview tracking

Automatic screenview reporting can be turned off on iOS by settingFirebaseAutomaticScreenReportingEnabled toNO (Boolean) in the Info.plist.

And on Android, nest the following setting within the<application> tag of theAndroidManifest.xml file:

<meta-dataandroid:name="google_analytics_automatic_screen_reporting_enabled"android:value="false"/>

Manually track screens

You can manually logscreen_view events whether or not automatic tracking isenabled. You can log these events in theonAppear orviewDidAppear methodsfor Apple platforms andonResume for Android. Whenscreen_class is not set,Analytics sets a default value based on the UIViewController or Activitythat 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 theAnalyticsSwift extension SDK.

Swift

Note: This Firebase product is not available on the macOS target.
Analytics.logEvent(AnalyticsEventScreenView,parameters:[AnalyticsParameterScreenName:screenName,AnalyticsParameterScreenClass:screenClass])

Objective-C

Note: This Firebase product is not available on the macOS target.
[FIRAnalyticslogEventWithName:kFIREventScreenViewparameters:@{kFIRParameterScreenClass:screenClass,kFIRParameterScreenName:screenName}];

Kotlin

firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW){param(FirebaseAnalytics.Param.SCREEN_NAME,screenName)param(FirebaseAnalytics.Param.SCREEN_CLASS,"MainActivity")}

Java

Bundlebundle=newBundle();bundle.putString(FirebaseAnalytics.Param.SCREEN_NAME,screenName);bundle.putString(FirebaseAnalytics.Param.SCREEN_CLASS,"MainActivity");mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW,bundle);

Web

import{getAnalytics,logEvent}from"firebase/analytics";constanalytics=getAnalytics();logEvent(analytics,'screen_view',{firebase_screen:screenName,firebase_screen_class:screenClass});

Web

firebase.analytics().logEvent('screen_view',{firebase_screen:screenName,firebase_screen_class:screenClass});

Dart

awaitFirebaseAnalytics.instance.logEvent(name:'screen_view',parameters:{'firebase_screen':screenName,'firebase_screen_class':screenClass,},);

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-18 UTC.