Firebase-ios-sdk: Bug: Firebase analytics sends 2 screen_view events, if you set screen name

Created on 12 Dec 2018  路  10Comments  路  Source: firebase/firebase-ios-sdk

  • Xcode version: 10.1
  • Firebase SDK version: 5.14.0
  • Firebase Component: Analytics

Steps to reproduce:

Set a custom name for your screen and look at the DebugView dashboard. Your will see 2 screen_view events reported.

Note:

This only happens only first time the view controller gets allocated and after view is allocated then it sends only one event if the view appears again.

Note 2:

If you are trying to re-produce this by looking at debug-view tool in Firebase dashboard, another bug in dashboard may cause you think this is not happening. Because there is a bug in dashboard which you need to reload the page from your browser otherwise you see more duplicated events in DebugView's real time view.

Comments:

As I understood, Analytics.setScreenName causes an event to be sent. (which needs to be discussed somewhere else as its not mentioned anywhere in docs that this triggers screen_view event and looks like just a simple set name as the function's name says too but seems its not).

By having this assumption that Analytics.setScreenName sends an event, as we call this func in viewDidApear right after super.viewDidAppear(animated), I'm just guessing that this is happening because maybe firebase is sending the screen_view event both in viewDidLoad and viewDidAppear. so this is why we get 2 events only first time the view controller gets allocated and after that we get only one event.

Relevant Code:

I'm settings the screen name as below with setting the screenClass to nil.

 Analytics.setScreenName("blabla", screenClass: nil)
analytics

Most helpful comment

We have also encountered this bug, and it took me quite a while to figure out that it was the screen name setting which was causing the issue. I've since been in contact with some helpful Google support members who tell me this is behaving as expected.

I am astounded that this bug - and it is a bug, no matter how you try to slice it - has existed for so long, and that its presence to Google receives absolutely no concern or priority. It is embarrassing and has drastic consequences on measurement. In the iOS header documentation, the class actually tells you how to use this API, and doing so by their instructions leads to duplicate events.

Here's a note to the misguided engineers who claim that this is not a problem:

  1. Marketers do not understand class names and we do not want to report our analytics in that way.
  2. Some view controllers are used in various contexts, and therefore reporting the class name is largely useless.

FIX THIS NOW or LET US REPORT OUR OWN SCREENS ACCURATELY BY OURSELVES.

All 10 comments

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@htcgh any news on this?

Internally tracking at b/121187306

Looks like a duplicate of this bug. For that bug, the quickstart-app was showing the same duplicate screen view when calling setScreen manually.

To re-iterate from there: For iOS, we intercept screen changes to automatically log a screen view event. This is how we are able to do automatic screen view reporting. The first and second screen_view (FoodPickerViewController and ViewController without the "firebase_screen") are logged because of this. The third screen_view event is due to the quickstart app calling setScreen manually.

This is working as intended as of now, however we may want to re-visit this in the future and possibly do some sort of de-duping screen_view events based on parameters.

Is there not a way to allow us to disable automatic screen tracking so we can manually do it with the setScreen instead?

this is such bad behavior. Google is forcing us to move away from the original Google Analytics SDK, but the Firebase Analytics is a half-baked product! why, Google?

We have also encountered this bug, and it took me quite a while to figure out that it was the screen name setting which was causing the issue. I've since been in contact with some helpful Google support members who tell me this is behaving as expected.

I am astounded that this bug - and it is a bug, no matter how you try to slice it - has existed for so long, and that its presence to Google receives absolutely no concern or priority. It is embarrassing and has drastic consequences on measurement. In the iOS header documentation, the class actually tells you how to use this API, and doing so by their instructions leads to duplicate events.

Here's a note to the misguided engineers who claim that this is not a problem:

  1. Marketers do not understand class names and we do not want to report our analytics in that way.
  2. Some view controllers are used in various contexts, and therefore reporting the class name is largely useless.

FIX THIS NOW or LET US REPORT OUR OWN SCREENS ACCURATELY BY OURSELVES.

+1 on supporting manual-only tracking. The automatic one is quite unreliable and doesn't know about app specifics. Navigation controllers are tracked but that doesn't make sense. Events are sent or duplicated when the screen doesn't actually change (the parent controller could change or the navigation controller removes the screen from the window for a split-second to perform the parallax transition etc). App developers can develop even more complex view controllers where it's impossible for a framework to foresee what should get tracked and when.
It's even worse when multiple view controllers are visible at the same time.

Looking at how tracking currently works, manual tracking should be doable by manually sending screen_view + adding the screen parameters to all other events, isn't it?

I've also been running thru the same issue, it seems like the thread is now close.
So there's no other fix than manual tracking ???
Analytics.setScreenName(screenName: String? screenClass: String?)
In that case how would i track defined parameters on each screen_view event?

Hi all, as mentioned in a previous comment here, this is a duplicate of: https://github.com/firebase/firebase-ios-sdk/issues/1894. We are actively working on this and that thread will be updated once there is a solution in place, thank you for your patience.

Was this page helpful?
0 / 5 - 0 ratings