Description
Description
We have multiple iOS apps in production which are using Firebase Analytics and our own internal analytics system in parallel to log their sessions. Our internal analytics system is setup to log all app foreground launches & moves from background to the foreground. When comparing those numbers to the session counts produced by Firebase Analytics we noticed suspiciously high session counts on Firebase Analytics side and decided to investigate further.
When the app is launched in iOS simulator and the -FIRDebugEnabled
launch argument is included, the session_start
event is emitted by Firebase SDK when the simulator receives a push notification payload with content-available: 1
flag, causing the OS to launch the app to the background. This only happens when more than 30 minutes has passed since the last session start event.
Based on Firebase documentation this should not be happening:
a session initiates when a user either opens your app in the foreground or views a page or screen and no session is currently active (e.g. their previous session has timed out).
In the end, we were able to reduce our GA4 session counts considerably by removing the content-available: 1
field from our push payloads.
A potentially related issue which has been already closed: #6161
Reproducing the issue
- Have an iOS app with push notifications & Remote notifications background mode enabled
- Add
-FIRDebugEnabled
launch argument in Xcode scheme editor - Select Launch:
Wait for the executable to be launched
in Xcode scheme editor - Select Product -> Run
- Send a push notification to that app in simulator
- Note that the app is launched into background by the iOS
- Note that
session_start
event is triggered (even though the app is in background), if more than 30 minutes has passed since the last push
Firebase SDK Version
10.18.0
Xcode Version
15.1
Installation Method
Swift Package Manager
Firebase Product(s)
Analytics
Targeted Platforms
iOS