Skip to content

Conversation

@GoodSir42
Copy link

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 and screen class are used the issue does not exist and screen views are tracked as before via logScreenView

See issue #8609 for more details on this.

It is likely that the EventParams firebase_screen and firebase_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

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • [-] e2e tests added or updated in packages/\*\*/e2e
    • [-] jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes (it will require changes to the passed in parameters, but it is more fixing than breaking)
    • [-] No

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 :) 🔥

@CLAassistant
Copy link

CLAassistant commented Sep 3, 2025

CLA assistant check
All committers have signed the CLA.

@vercel
Copy link

vercel bot commented Sep 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
react-native-firebase Ready Ready Preview Comment Sep 17, 2025 11:21am

@GoodSir42
Copy link
Author

it would be great to get some movement into this rather minor change :) so far @liamjones had a look, but we need another person to review it

@vanGalilea
Copy link

it would be great to get some movement into this rather minor change :) so far @liamjones had a look, but we need another person to review it

Can we expedite this one please, it will help us a lot, tnx :)

Copy link
Collaborator

@MichaelVerdon MichaelVerdon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for making this:

Are we able to get it fully matching https://firebase.google.com/docs/analytics/screenviews#web ??
Our aim on React Native Firebase is to make it match the js-sdk so users if not looking at react native docs can also refer to js.

@GoodSir42
Copy link
Author

GoodSir42 commented Oct 7, 2025

LGTM thanks for making this:

Are we able to get it fully matching https://firebase.google.com/docs/analytics/screenviews#web ?? Our aim on React Native Firebase is to make it match the js-sdk so users if not looking at react native docs can also refer to js.

unfortunately not, as those property names are illegal for the native SDKs. I also thought about exposing the names like on the JS SDK but then change them internally, but I am a bit lost in the js code there

@GoodSir42
Copy link
Author

The only possibility to keep the invalid parameter names I see right now is to have an if in the logEvent function that rebuilds the parameters. If you have any better hints I would gladly implement them. @MichaelVerdon

@GoodSir42
Copy link
Author

any news on this?

@AdamGerthel
Copy link

AdamGerthel commented Oct 21, 2025

I'd also love to get some clarity here before I change to using logEvent and potentially break my analytics. I'm seeing a TypeScript warning when using logEvent with name 'screen_view'. Is this how it's supposed to be?:

Before: logScreenView(firebaseAnalytics, { screen_name: name })
After: logEvent(firebaseAnalytics, 'screen_view', { firebase_screen: name })

Screenshot 2025-10-21 at 14 15 19

This is on v23.4.1

@GoodSir42
Copy link
Author

GoodSir42 commented Oct 21, 2025

yes. you MUST NOT use the names starting with firebase_ as those names are illegal for the native frameworks. The warning tells you that you cannot use screen_view together with firebase_screen. Production will not highlight that on the type script layer, but you will break your analytics with the code above.

If you want to ensure you get no warning in prod you need to specify both firebase_screen_class and firebase_screen. But this will break your screen tracking.

Something like this will throw a TS warning but work:

logEvent(getAnalytics(), 'screen_view', { screen_class: screenName, screen_name: screenName, });

@liamjones
Copy link
Contributor

@AdamGerthel Beyond what @GoodSir42 said, you can check the events as they are picked up by Google Analytics by using DebugView.

You'll then be able to see errors in the events like I screenshotted above: #8687 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛] logEvent versus logScreenView

6 participants