10

I have successfully implemented screen tracking for a react native project that uses react-navigation with react-native-firebase/analytics.

Looking at the dashboard under events I see the following events (image below). As you can see the top 2 events are automatically tracked 1. MainActivity, 2. UIViewController and they take up most of the total. I would like to remove those screens from the tracking to only show the screens of the JS side of the app (react-navigation).

Is this possible? How can I achieve this?

Thank you in advance ❤️‍♂️

Screenshot of screen tracking

Hugo Pretorius
  • 452
  • 1
  • 3
  • 15

2 Answers2

4

Analytics.setCurrentScreen(, ) will override the Screen class of the native MainActivity and UIViewController.

I recommend setting this as soon as possible when your app starts up, perhaps even on the splash screen. This way it will minimize the Avg. time spent on the native screens and over time they will go down to the bottom of the list.

There is currently no option to disable those screens from being tracked

Hugo Pretorius
  • 452
  • 1
  • 3
  • 15
  • `Analytics.setCurrentScreen(, )` do you suggest to set something specific there? Or keep it empty? – dreambit.io dreambitio Jan 16 '22 at 01:00
  • 4
    `Analytics.setCurrentScreen(screenName, screenClassOverride)` is marked as Deprecated and will be removed in Expo SDK 45. How should we go about this issue in the future? – heidgert Feb 24 '22 at 15:22
4

You can now stop automatic screen tracking through the firebase.json file.

// <project-root>/firebase.json
{
  "react-native": {
    "google_analytics_automatic_screen_reporting_enabled": false
  }
}

Please refer to the official documentation for more information.

128KB
  • 398
  • 3
  • 12
ksh
  • 399
  • 2
  • 16