19

Firebase Analytics has a number of stats around "Sessions" (like "Sessions per user" and "Average session length"), but how exactly does Firebase Analytics define a session?

Todd Kerpelman
  • 16,875
  • 4
  • 42
  • 40

2 Answers2

24

And I'll answer my question by saying that Firebase Analytics defines a session as a user engaging with your app for a minimum amount of time (10 seconds by default) followed by your user not engaging with your app for a certain amount of time (30 minutes by default). But you can change those times if you'd like something different.

So if a user starts using your app, switches to messaging to send a message, goes back to your app, switches to messaging again to send a quick selfie, then goes back to your app, that's all considered just one session.

Similarly if a user accidentally taps on your app icon and then quickly switches away to open up the app they actually meant to open, that won't get recorded as a session.

Todd Kerpelman
  • 16,875
  • 4
  • 42
  • 40
  • 1
    Thanks for that *easy-to-absorb* info Todd. I'm not quite familiar with Firebase Analytics, but I noticed you mentioned that "*But those exact times are subject to change.*" -- is it possible for the developer to define the duration (i.e. the user not engaging part, instead of 30 mins, set it to 1 hour or so) on when to consider that it is a "*Session*"? – AL. Dec 08 '16 at 01:48
  • 1
    Hi, AL. As Dan noted below, these are default values and you can change them. On Android, it's within the [Firebase Analytics](https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics) class and on iOS, it's through the [FIRAnalyticsCofiguration](https://firebase.google.com/docs/reference/ios/firebasecore/api/reference/Classes/FIRAnalyticsConfiguration) class – Todd Kerpelman Dec 20 '16 at 17:54
  • @ToddKerpelman, What "as a user engaging with your app" is stand for? Is it UI events sent or any firebase events? I'm interested in the context of Android TV's "tv input" applications, which usually doesn't have it's own UI – Michael Sotnikov Mar 06 '17 at 08:03
  • @MichaelSotnikov It simply means a user has your app in the foreground on their device. – Todd Kerpelman Mar 08 '17 at 23:25
  • @ToddKerpelman, Thank You. But I specifically mentioned AndroidTV. Cause there is no own UI for "tv input app". It works as the service for host system app (Live Channels) which has own UI. So there is no background/foreground for client app. But if it sends other events to Firebase analytics will it be counted as session activity? Any other way to say firebase that session is active, cause for "tv input" app it's real session - user watches channel, switches channels and peroform other UI activities but not through client app, but through host app (Live Ch. or other vendor's derivatives) – Michael Sotnikov Mar 10 '17 at 07:27
  • Can you help me with this [question](https://stackoverflow.com/questions/47438092/in-app-billing-connect-to-firebase-and-get-products) please? – StuartDTO Nov 27 '17 at 09:32
  • How about if the user hard closes the app and then re opens it. Is that considered a new session? – Jonas Stawski Jun 12 '20 at 14:37
  • hey @ToddKerpelman I know you are Firebase wizard - could you please help with this question https://stackoverflow.com/questions/67882661/campaign-details-event-is-not-logged-in-firebase – Evgeny Karkan Jul 22 '21 at 14:25
  • Hi All, I have a related question about Crashlytics. Kindly have a look. https://stackoverflow.com/questions/75930120/whats-a-user-session-in-firebase-crashlytics-event-report – Vikas Pandey Apr 04 '23 at 14:01
12

Adding to Todd Kerpelman's response above, you can customize the definition of a session via FirebaseAnalytics.setSessionTimeoutDuration(long millis).

The docs are at: https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics

(Sorry, don't have the reputation to make this a comment)

[EDIT: removed obsolete reference to setMinimumSessionDuration]

Dan Morenus
  • 1,068
  • 8
  • 12