The tabris-plugin-firebase
plugin project provides a Tabris.js API to track app usage via firebase analytics. The tracked data is available in the firebase console. The plugin support screen and event tracking as well as user properties.
By default the plugin does NOT track any usage data. You have to enable analytics tracking by setting analyticsCollectionEnabled
to true
:
firebase.Analytics.analyticsCollectionEnabled = true;
The following example shows typical usage of the analytics API:
// enable analytics data collection (has to be done upfront)
firebase.Analytics.analyticsCollectionEnabled = true;
// provide more details about the current user
firebase.Analytics.setUserPoperty(`power_user`, true);
// set the screen name where subsequent events are tracked
firebase.Analytics.screenName = 'main_screen';
// track event triggered by user
firebase.Analytics.logEvent('view_item', {description: 'full_membership'});
The firebase analytics API is represented as the global object firebase.Analytics
.
All Analytics
properties are write only.
- Enables analytics data collection for this app. To make use of firebase analytics data collection has to be enabled by the developer. The enablement persists across sessions.
- Sets the current screen name, which specifies the current visual context in your app. This helps identify the areas in your app where users spend their time and how they interact with your app.
- Sets the user ID property. Should not expose sensitive data.
- Logs an app event. The event can have up to 25 parameters. Events with the same name must have the same parameters. Up to 500 event names are supported. Using predefined event and/or parameters is recommended for optimal reporting.
- Sets a user property to a given value. Up to 25 user property names are supported. Once set, user property values persist throughout the app lifecycle and across sessions.