capacitor-community / firebase-analytics

Enable Firebase Analytics for Capacitor Apps
MIT License
159 stars 63 forks source link

Question about the screen_view #179

Open loic-parent opened 3 months ago

loic-parent commented 3 months ago

Hello,

I have prepared the data in the application but I'd like to know what is the best approach to track the navigation.

I have defined the setup method in the file app.component.ts: FirebaseAnalytics.initializeFirebase(env.fbConfigs)

I use the default method "setScreenName":

FirebaseAnalytics.setScreenName({
    screenName: "A custom name of the page),
    nameOverride: "nameOfTheClass"
});

I need to get more information for each screen_view such as "lang" and "ID". So is it possible to add/pass some params for the event screen_view using a custom event call instead of the method "setScreenName"?

Something like this:

FirebaseAnalytics.logEvent({
    name: "screen_view",
    params: {
        screenName: 'A custom name of the page)',
        nameOverride: "nameOfTheClass"
        pageId: 5,
        pageLang: 'de',
    }
});

Thanks for your help, Loïc