firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

Engagement Time is logged incorrectly when disable screen view tracking

Open chalermpong opened this issue 3 years ago • 62 comments

[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

  1. Start app and kill the app quickly before FA logs engagement time (explanation in note below).
  2. Send a data message to the app
  3. Open app again
  4. 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: ...

chalermpong avatar Dec 14 '21 07:12 chalermpong

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Dec 14 '21 07:12 google-oss-bot

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!

argzdev avatar Dec 14 '21 13:12 argzdev

@argzdev Here is the code that can reproduce this issue. https://github.com/chalermpong/FirebaseEngagementTime

chalermpong avatar Dec 14 '21 16:12 chalermpong

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 avatar Dec 14 '21 18:12 argzdev

Our engineers have been notified and will look into this. This is now internally tracked on b/210863612. Thanks!

argzdev avatar Dec 15 '21 17:12 argzdev

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.

OksanaAxonista avatar Jan 13 '22 13:01 OksanaAxonista

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?

mana-break avatar Feb 15 '22 20:02 mana-break

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. download

woodii avatar Apr 15 '22 06:04 woodii

Hi, same problem here. We've compared to our previous version and to iOS.

Screenshot 2022-07-26 at 10 45 41

Can we expect this to be solved or should we enable automatic screen reporting to get our engagement stats back?

Cheers!

tompesman avatar Jul 26 '22 09:07 tompesman

@tompesman I posted my workaround here. Let's see if it's work on your project.

image

chalermpong avatar Jul 26 '22 16:07 chalermpong

That's an interesting one, are you sure that there are no side effects?

tompesman avatar Jul 29 '22 13:07 tompesman

@tompesman You are right. I'm not sure if there is any side effect.

@argzdev Could you help us confirm if there are no side effects from using this workaround?

Instead of adding this line in AndroidManifest.xml,

<meta-data android:name="google_analytics_automatic_screen_reporting_enabled" android:value="false" />

I used setAnalyticsCollectionEnabled in Activity's onResume to disable automatic screen tracking as shown in code below.

override fun onResume() {
    FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false)
    super.onResume()
    FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(true)
}

chalermpong avatar Jul 29 '22 17:07 chalermpong

Hi all, thank you for the inputs! Unfortunately, I can't verify if this workaround has no side effects.

I have escalated this to our engineering team, and it looks like our engineers are still investigating this along with other issues and tasks. Given that their hands are full at the moment, it my take some time for them to dig deeper in this issue. That being said, while I’m unable to promise any timeline for this, adding a thumbs up on this issue can help our engineers prioritize this based on the demand and severity.

argzdev avatar Jul 29 '22 19:07 argzdev

Also having the same issue, which makes engagement statistics useless.

@argzdev How do I thumbs up an issue on GitHub? Do you mean using the reaction emojis?

leontodd avatar Aug 16 '22 20:08 leontodd

Yes @leontodd, apologies if that was confusing.

argzdev avatar Aug 17 '22 08:08 argzdev

Hi, @argzdev there's any update on this issue? I'm experimenting the same misbehaviour after disabling automatic screen reporting

jaumebd avatar Nov 21 '22 11:11 jaumebd

Are there some new updates? This issue is still on our apps.

Julian-Cao avatar Dec 29 '22 04:12 Julian-Cao

Hello, Same problem here...

image

mypplication avatar Jan 30 '23 08:01 mypplication

Hi, Is there any update on this issue? @argzdev

taylornzme avatar May 19 '23 04:05 taylornzme

Hi @TaylorPringleNZME, thanks for following up on us. Looking into the internal bug, it seems that there's a fix on going, though I'm not sure if this has been merged on the latest version. I'll try to get some updates from our engineers. But if possible, please do try using our latest version to see if the fix has been applied. Thanks!

argzdev avatar May 22 '23 12:05 argzdev

Hi @TaylorPringleNZME, thanks for following up on us. Looking into the internal bug, it seems that there's a fix on going, though I'm not sure if this has been merged on the latest version. I'll try to get some updates from our engineers. But if possible, please do try using our latest version to see if the fix has been applied. Thanks!

Hi @argzdev, is there any way we can track the fix? Thanks for the update

taylornzme avatar May 23 '23 04:05 taylornzme

Sorry @TaylorPringleNZME, currently the bug details are only available internally, but feel free to ping on any threads whenever you'd like to get an update, and we'll take a look into it.

Our engineers have informed us that the fix for this issue is being rolled out right now. There is no need to update the SDK version for an app unless the app is being distributed on non-Play devices.

Full rollout is expected by the end of this week.

argzdev avatar May 23 '23 09:05 argzdev

Hi @argzdev, thank you for the update.

Are you able to confirm if the fix was fully rolled out last week please? Also when would we expect to see a change in results?

taylornzme avatar May 28 '23 21:05 taylornzme

Hi all,

I am writing down an analytics solution for a client of ours and I'm stuck on below question (and can't seem to find a clear answer anywhere):

Does your engagement time still get logged if you disable the automatic screen view tracking?

The plan is to implement the screen_view event ourselves, however in the example code the user_engagement_msec is not added to the custom event (https://firebase.google.com/docs/analytics/screenviews).

So, I am wondering is that intentional or is it just to keep the example simple?

I bumped into this post, and I know my question is not entirely on topic, but it thought that somebody in this audience might know the answer.

Appreciate it if somebody can give a clear answer!

debaerebart avatar Jun 05 '23 11:06 debaerebart

Yes @TaylorPringleNZME, the fix should be fully rolled out by now. You should start seeing a change in results immediately.

@debaerebart it would be best if you reach out to our Firebase support team. They'll be able to clarify any questions you may have.

That said, since this issue have been resolved. I'll close this now. If anyone experiences this issue again, just let me know and we'll reopen this thread. Thanks!

argzdev avatar Jun 12 '23 10:06 argzdev

@argzdev are you sure this will take effect immediately? I don't see any changes on our side. image

woodii avatar Jun 13 '23 14:06 woodii

Same here. No change at all.

mthormann-dhi avatar Jun 13 '23 14:06 mthormann-dhi

Hi @woodii, it should have improvements compared to the past few days but clearly this doesn't look like it. Let me get some feedback from our engineers. Thanks for checking!

If others have a different finding/behavior, let me know. Thanks!

argzdev avatar Jun 13 '23 14:06 argzdev

Hi @argzdev, we have also not seen any changes in the past few days.

taylornzme avatar Jun 13 '23 20:06 taylornzme

@argzdev are you sure this will take effect immediately? I don't see any changes on our side. image

@woodii The fix is at 50% rollout, so by now you should see a significant improvement. Since you aren't, can you share with me your package name so I can research further?

lbarrettanderson avatar Jun 20 '23 17:06 lbarrettanderson