Open
Description
[READ] Step 1: Are you in the right place?
Yes.
[REQUIRED] Step 2: Describe your environment
- Android Studio version: Android Studio Arctic Fox | 2020.3.1 Patch 3
- Firebase Component: Analytics
- Component version: 20.0.1 (Firebase BoM 29.0.2)
[REQUIRED] Step 3: Describe the problem
This issue is related to my previous issue #3039
Firebase Analytics logs incorrect engagement time. As shown in Log below
2021-12-14 13:42:21.554 16014-16064/my.app.package I/FA: App measurement initialized, version: 46000
2021-12-14 13:42:21.554 16014-16064/my.app.package I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2021-12-14 13:42:21.554 16014-16064/my.app.package I/FA: Faster debug mode event logging enabled. To disable, run:
adb shell setprop debug.firebase.analytics.app .none.
2021-12-14 13:42:21.554 16014-16064/my.app.package D/FA: Debug-level message logging enabled
2021-12-14 13:42:21.580 16014-16064/my.app.package V/FA: Connecting to remote service
2021-12-14 13:42:21.590 16014-16064/my.app.package V/FA: Connection attempt already in progress
2021-12-14 13:42:21.595 16014-16064/my.app.package V/FA: Connection attempt already in progress
2021-12-14 13:42:21.596 16014-16064/my.app.package D/FA: Connected to remote service
2021-12-14 13:42:21.596 16014-16064/my.app.package V/FA: Processing queued up service tasks: 3
2021-12-14 13:42:26.625 16014-16064/my.app.package V/FA: Inactivity, disconnecting from the service
2021-12-14 13:42:50.656 16014-16055/my.app.package V/FA: onActivityCreated
2021-12-14 13:42:50.700 16014-16064/my.app.package V/FA: Activity resumed, time: 246386362
2021-12-14 13:42:50.701 16014-16055/my.app.package V/FA: Logging screen view with name, class: main, MainActivity1
2021-12-14 13:42:50.705 16014-16064/my.app.package I/FA: Tag Manager is not found and thus will not be used
2021-12-14 13:42:50.728 16014-16064/my.app.package V/FA: Connecting to remote service
2021-12-14 13:42:50.745 16014-16064/my.app.package V/FA: Connection attempt already in progress
2021-12-14 13:42:50.799 16014-16064/my.app.package D/FA: Connected to remote service
2021-12-14 13:42:50.802 16014-16064/my.app.package V/FA: Processing queued up service tasks: 2
2021-12-14 13:42:55.810 16014-16064/my.app.package V/FA: Inactivity, disconnecting from the service
2021-12-14 13:42:56.270 16014-16064/my.app.package V/FA: Activity paused, time: 246391932
2021-12-14 13:42:58.272 16014-16064/my.app.package D/FA: Application going to the background
2021-12-14 13:42:58.283 16014-16064/my.app.package V/FA: Recording user engagement, ms: 34745
Explanation for the log above
I kill the app before start of the log above.
13:42:21.554 <-- I sent a data message to the app
13:42:50.700 <-- I started the app
13:42:56.270 <-- I left the app using Android home button
The engagement time should be around 6 seconds, but Firebase Analytics logged 34745 milliseconds. Seems like FA started logging engagement time when app received a data message.
Steps to reproduce:
Prerequisite: The app must disable screen view tracking, and be able to receive data message
- Start app and kill the app quickly before FA logs engagement time (explanation in note below).
- Send a data message to the app
- Open app again
- Stay in the first screen for a few seconds then leave the app. FA will log engagement time = time since it received the data message instead of time since app open.
Note: When disable screen view tracking, there will be ~2 seconds delay before FA logs engagement time. So it is possible to kill the app quickly before Recording user engagement
happens.
2021-12-14 13:42:56.270 16014-16064/my.app.package V/FA: Activity paused, time: 246391932
2021-12-14 13:42:58.272 16014-16064/my.app.package D/FA: Application going to the background
2021-12-14 13:42:58.283 16014-16064/my.app.package V/FA: Recording user engagement, ms: 34745
If the app is not disable screen view tracking, the Recording user engagement, ms: ...
will happen before Activity paused, time: ...
Activity
google-oss-bot commentedon Dec 14, 2021
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
[-]Engagement Time is logged [/-][+]Engagement Time is logged incorrectly when disable screen view tracking[/+]argzdev commentedon Dec 14, 2021
Hi @chalermpong, thanks for reporting. I'll try to check this and see what I can find. In the meantime, if you can provide us with an MCVE, that'll greatly help us with the investigation. Thanks!
chalermpong commentedon Dec 14, 2021
@argzdev Here is the code that can reproduce this issue.
https://github.com/chalermpong/FirebaseEngagementTime
argzdev commentedon Dec 14, 2021
Thanks for the MCVE, @chalermpong. I was able to repro the issue, I'll notify an engineer and see what we can do here.
argzdev commentedon Dec 15, 2021
Our engineers have been notified and will look into this. This is now internally tracked on b/210863612. Thanks!
OksanaAxonista commentedon Jan 13, 2022
Hello, I have the same issue.
Since 26 August our engagement times started to rise significantly only on Android
It happens with every screen.
Here are screenshot from GA for splash.
mana-break commentedon Feb 15, 2022
I have the same problem. In August 2021 I disabled google_analytics_automatic_screen_reporting_enabled and my in-app engagement time doubled. I would like to know if this is a bug or a consequence of using the google_analytics_automatic_screen_reporting_enabled flag?
woodii commentedon Apr 15, 2022
We have the exact same issue. We implemented manual screen tracking on both our apps (android and ios) but in the android app the engagement time (average and per session) skyrocketed by 700% from that release on.

56 remaining items