-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(analytics): fix the typing for screen_view event logging #8687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
firebase_screen: EventParams['firebase_screen']; | ||
firebase_screen_class: EventParams['firebase_screen_class']; | ||
screen_name: EventParams['firebase_screen']; | ||
screen_class: EventParams['firebase_screen_class']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these meant to be EventParams['screen_name']
and EventParams['screen_class']
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, only one of those exists in @react-native-firebase/analytics/lib/index.d.ts
:
export interface EventParams {
//...
screen_name?: string;
/**
* Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
*/
firebase_screen?: string;
/**
* Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
*/
firebase_screen_class?: string;
//...
}
Should one of these not exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the logs/FB console on the web anything prefixed with firebase should not be used as a parameter since they are internal. SO yes. I think it should be screen_name
and screen_class
and the firebase_screen
and firebase_screen_class
should be removed. I just left them in to be checked by someone with deeper knowledge of why they have been put in in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liamjones can I see the thumbs up as a hint to remove the firebase_ prefixed properties or is it a plus one for the need for somebody else to look into it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GoodSir42 Ah, apologies for the ambiguity. It definitely needs to be without the firebase_
prefix.
If you enable GA's DebugView and log an event using firebase_screen_view
it'll show an error:

Error 14 is "Event parameter name is reserved" (see https://firebase.google.com/docs/analytics/errors) and error_value
is set to firebase_screen_name
.
If you use screen_view
DebugView will show it under firebase_screen
and there is no error:

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that was my original lead. I'll update the code
Description
Motivation:
Since migrating from logScreenView to logging screen_view events we lost the screen tracking in our project. To prevent this from happening to other developers only the typing information has to be fixed.
Without the change developers are encouraged to use faulty parameter names, leading to errors in the firebase backend and dropped events due to reserved property names. If the names
screen_name
andscreen class
are used the issue does not exist and screen views are tracked as before via logScreenViewSee issue #8609 for more details on this.
It is likely that the EventParams
firebase_screen
andfirebase_screen_class
are not needed any more.Related issues
Fixes #8609
Release Summary
This changes the names you need to supply to logEvent(analytics, 'screen_view') to what it should have been already. Without a change to parameter names your screen tracking will not work!
Checklist
Android
iOS
Other
(macOS, web)e2e
tests added or updated inpackages/\*\*/e2e
jest
tests added or updated inpackages/\*\*/__tests__
Test Plan
I only changed typings and validated the change in my own Project since it requires checks on the firebase debugging backend.
And since I read the whole guide I am allowed to add some flames in the end :) 🔥