React-native-firebase: Track screen view when using react-navigation

Created on 24 Dec 2017  路  7Comments  路  Source: invertase/react-native-firebase

On native platform, firebase analytics track screen by android activity or ios viewcontroller.
On react-native, screen navigation is usually achieved by library like react-navigation.

Can we make some changes to allow firebase log correct screen name configured in react-navigation?

Most helpful comment

All 7 comments

What arguments are you passing to the log?

@Ehesp Is it possible if we just don't put any log?
Looks like for screen navigation on native app, firebase analytics automatically track the view of each screens. This is not the case for react-native apps.

Normal react native apps all run on a single view controller /activity. You can track the page view via analytics manually, which takes 2 arguments. On my phone at the moment so can't check.

https://rnfirebase.io/docs/v3.2.x/analytics/reference/analytics#setCurrentScreen

setCurrentScreen(screenName, screenClassOverride) returns void;

react-navigation has a very nice guide on setting up screen tracking:
https://reactnavigation.org/docs/guides/screen-tracking

We use it with redux and use a middleware

Thank you everyone.

I found a nice guideline on how to do that with redux, here https://github.com/react-navigation/react-navigation/blob/master/docs/guides/Screen-Tracking.md.

However, the page is only available on google's cache.

Was this page helpful?
0 / 5 - 0 ratings