Skip to content

[🐛] logEvent versus logScreenView #8609

Closed

Description

@faljabi

Issue

When switching to modular api for logging screens

await logEvent(analytics, 'screen_view', {
                firebase_screen: currentRouteName,
                firebase_screen_class: currentRouteName
});

I see UIViewController or MainActivity on the Analytics Dashboard. It was working fine with showing my screen names instead using the below:

await logScreenView(analytics, {
                screen_name: currentRouteName,
                screen_class: currentRouteName
});

Project Files

Javascript

Click To Expand

package.json:

"@react-native-firebase/analytics": "^22.4.0",
    "@react-native-firebase/app": "^22.4.0",
    "@react-native-firebase/crashlytics": "^22.4.0",
    "@react-native-firebase/firestore": "^22.4.0",
    "@react-native-firebase/remote-config": "^22.4.0",

firebase.json for react-native-firebase v6:

{
    "react-native": {
        "analytics_auto_collection_enabled": true,
        "google_analytics_automatic_screen_reporting_enabled": false,
        "crashlytics_debug_enabled": true,
        "crashlytics_disable_auto_disabler": true,
        "crashlytics_auto_collection_enabled": true,
        "crashlytics_is_error_generation_on_js_crash_enabled": true,
        "crashlytics_javascript_exception_handler_chaining_enabled": false
    }
}

Any advise?

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:

Activity

  1. changed the title [-][🐛] Bug Report Title - CHANGE ME[/-] [+][🐛] logEvent versus logScreenView[/+] on Jul 11, 2025
  2. goltra commented on Jul 14, 2025

    @goltra

    If I use directly logEvent passing analytics app instance, my IDE throw this:

    TS2769: No overload matches this call.
    The last overload gave the following error.
    Argument of type "screen_view" is not assignable to parameter of type
    "add_to_cart" | "add_to_wishlist" | "remove_from_cart"
    index.d.ts(422, 25): The last overload is declared here.

    I don't know if it could be relationated.

  3. MichaelVerdon commented on Jul 14, 2025

    @MichaelVerdon
    Contributor

    Hi there, I am not sure what your issue is, could you please rephrase it? Are you saying that using Modular API does not work?

  4. goltra commented on Jul 14, 2025

    @goltra

    Firstly my function was like this and work but I have a warning in console inviting me to use Modular api:

    const analytic = getAnalytics();
    const trackScreen = async (screenName: string, screenClass: string) => {
            await analytic.logEvent('screen_view',{screen_name: screenName, screen_class: screenClass});
        }

    I have change for this:

    const analytic = getAnalytics();
    const trackScreen = async (screenName: string, screenClass: string) => {
            logEvent(analytic, "screen_view", {screen_name: screenName, screen_class: screenClass});
        }

    but my IDE (phpstorm) show a warning

    Image

    If I launch the app, it works, but it's quite confusing and makes you doubt if you're doing it correctly

  5. goltra commented on Jul 14, 2025

    @goltra

    sorry, I have seen my mistake. I have to pass firebase_screen and firebase_screen_class instead of screen_name and screen_class

  6. faljabi commented on Jul 14, 2025

    @faljabi
    Author

    Hi there, I am not sure what your issue is, could you please rephrase it? Are you saying that using Modular API does not work?

    Hi @MichaelVerdon, the issue is that when using logScreenView I can see my screens names correctly on the firebase dashboard, but when using

    await logEvent(analytics, 'screen_view', {
                    firebase_screen: currentRouteName,
                    firebase_screen_class: currentRouteName
    });
    

    All screens are logged as "UIViewController" for iOS or "MainActivity" for Android and not my screen names provided! so for now I'm sticking with logScreenView and accepting the warning.

    Image

  7. MichaelVerdon commented on Jul 14, 2025

    @MichaelVerdon
    Contributor

    Hi there, thanks for further clarification, so simply, the screen names are not logged properly when using the modular reference as opposed to namespaced (which does show the correct names of all of your screens)?

  8. 36 remaining items

  9. GoodSir42 commented on Oct 7, 2025

    @GoodSir42

    The issue is still not stale, because there is a pr fixing it

  10. GoodSir42 commented on Oct 22, 2025

    @GoodSir42

    just another coment here to prevent the bot from marking the issue as stale. The PR still exists and the issue will just get bigger with every project migrating the wrong way

  11. github-actions commented on Nov 19, 2025

    @github-actions
    Contributor

    Hello 👋, to help manage issues we automatically close stale issues.

    This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

    This issue will be closed in 15 days if no further activity occurs.

    Thank you for your contributions.

  12. GoodSir42 commented on Nov 19, 2025

    @GoodSir42

    Nope, still active for the same reasons as before

  13. faljabi commented on Dec 11, 2025

    @faljabi
    Author

    Any update?

  14. ashuvssut commented on Dec 14, 2025

    @ashuvssut
  15. GoodSir42 commented on Dec 15, 2025

    @GoodSir42

    @ashuvssut I detailed and made the necessary changes in this PR: github.com//pull/8687 maybe consider also posting there so that it is finally merged. it's important that you do NOT put the firebase_ fields into the payload or firebase will ignore your events because they are malformed.

  16. ashuvssut commented on Dec 15, 2025

    @ashuvssut
    Contributor

    it's important that you do NOT put the firebase_ fields into the payload or firebase will ignore your events because they are malformed.

    Thanks for this clarification.
    Regarding your PR, thanks for pointing it out. I’ve subscribed to it. Maintainer resources seem limited, hope it gets reviewed soon

  17. ashuvssut commented on Dec 19, 2025

    @ashuvssut
    Contributor

    @russellwheatley Is this issue fixed by PR #8651? If so, does this mean that there is no need for this PR #8687 anymore and the fixes would be avaible in the upcoming release?

  18. russellwheatley commented on Dec 23, 2025

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions