Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
O Google Analytics rastreia as transições de tela e vincula informações
sobre a tela atual aos eventos. Isso permite que você faça o rastreamento de métricas, como o
engajamento ou o comportamento dos usuários por tela. Grande parte dessa coleta de dados é feita
automaticamente, embora também seja possível registrar as exibições de tela manualmente. O rastreamento manual
de telas é útil quando seu app não utiliza um UIViewController, View
ou uma Activity distinta para cada tela que você quer rastrear, como em um jogo.
Rastrear telas automaticamente
O Analytics rastreia automaticamente algumas informações sobre as telas no seu
aplicativo, como o nome da classe do UIViewController ou Activity em
curso no momento. Quando ocorre uma transição de tela, o Analytics registra um
evento screen_view que identifica a nova tela. Os eventos que ocorrem nessas
telas são marcados automaticamente com o parâmetro firebase_screen_class (por
exemplo, menuViewController ou MenuActivity) e um
firebase_screen_id gerado. Se seu app usa um UIViewController ou uma
Activity diferente para cada tela, o Analytics pode rastrear automaticamente todas as transições
de tela e gerar um relatório sobre o engajamento dos usuários dividido por tela. Se esse não for o caso,
você ainda pode gerar esses relatórios registrando eventos
screen_view manualmente.
Desativar o rastreamento de exibição de tela
Para desativar o relatório automático de exibição de tela no iOS, defina
FirebaseAutomaticScreenReportingEnabled como NO (booleano) no Info.plist.
No Android, aninhe a seguinte configuração na tag <application> do arquivo AndroidManifest.xml:
É possível registrar manualmente os eventos screen_view, mesmo que o rastreamento automático esteja
ativado. Você pode registrar esses eventos nos métodos onAppear ou viewDidAppear
para plataformas da Apple e onResume para Android. Quando screen_class não está definido, o Analytics define
um valor padrão com base no UIViewController ou na atividade que está em curso
quando a chamada é feita.
Se você desativou o swizzling no app, todos os nomes de tela precisarão ser definidos manualmente.
Para usuários da SwiftUI, use o SDK de extensão da Swift do Analytics.
Swift
Observação: este produto do Firebase não está disponível no destino macOS.
[null,null,["Última atualização 2025-08-21 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 );"]]