Integrating Firebase analytics is super simple using Firestack. A number of methods are provided to help tailor analytics specifically for your own app. The Firebase SDK includes a number of pre-set events which are automatically handled, and cannot be used with custom events:
'app_clear_data',
'app_uninstall',
'app_update',
'error',
'first_open',
'in_app_purchase',
'notification_dismiss',
'notification_foreground',
'notification_open',
'notification_receive',
'os_update',
'session_start',
'user_engagement',
Log a custom event with optional params.
firestack.analytics().logEvent('clicked_advert', { id: 1337 });
Sets whether analytics collection is enabled for this app on this device.
firestack.analytics().setAnalyticsCollectionEnabled(false);
Sets the current screen name, which specifies the current visual context in your app.
Whilst
screenClassOverride
is optional, it is recommended it is always sent as your current class name, for example on Android it will always show as 'MainActivity' if not specified.
firestack.analytics().setCurrentScreen('user_profile');
Sets the minimum engagement time required before starting a session. The default value is 10000 (10 seconds).
firestack.analytics().setMinimumSessionDuration(15000);
Sets the duration of inactivity that terminates the current session. The default value is 1800000 (30 minutes).
firestack.analytics().setSessionTimeoutDuration(900000);
Gives a user a uniqiue identificaition.
const id = firestack.auth().currentUser.uid;
firestack.analytics().setUserId(id);
Sets a key/value pair of data on the current user.
firestack.analytics().setUserProperty('nickname', 'foobar');