Google Firebase Analytics

Google Firebase Analytics helps you understand what your users are doing in your app. It has all of the metrics that you’d expect in an app analytics tool (average revenue per user (ARPU), active users, retention reports, event counts, etc.) combined with user properties like device type, app version, and OS version to give you insight into how users interact with your app.

Create a Firebase Project in the Firebase Console

Refer to the Firebase documentation for
Android
iOS

Follow steps 1 through 3 to set up a project in the Firebase Console. In summary you will provide your Package Name or iOS Bundle ID to then generate a GoogleService-Info.plist file for iOS and a google-services.json file for Android (if you are only deploying to one platform you only need to follow the instructions that are applicable).

Rather than following the steps to add these files to your app locally add the file contents directly to your app on our online build platform.

883883

GoogleService-Info.plist file for iOS

18881888

google-services.json file for Android

Default logging

By default, Firebase tracks common app events including app start, activities viewed, and app usage.

Advanced logging

Use the GoNative JavaScript Bridge to log additional events through your website

↔️GoNative JavaScript Bridge

  1. Call firebaseAnalytics.setAnalyticsCollectionEnabled(boolean)
gonative.firebaseAnalytics.event.collection({'enabled':BOOLEAN});
  1. Call firebaseAnalytics.setUserId(String)
gonative.firebaseAnalytics.event.setUser({'ID':STRING});
  1. Call firebaseAnalytics.setUserProperty(StringKey, StringValue)
gonative.firebaseAnalytics.event.setUserProperty({'key':STRING, 'value':STRING});
  1. Call firebaseAnalytics.setDefaultEventParameters(params)
gonative.firebaseAnalytics.event.defaultEventParameters(data);
//data is an object of key-value pairs converted into bundle params
  1. Call firebaseAnalytics.logEvent(eventName, params)
gonative.firebaseAnalytics.event.logEvent({
  'event':STRING, 
  'data': OBJECT
});
//called with the fixed screenClass="MainActivity"
  1. Call firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW, bundle)
gonative.firebaseAnalytics.event.logScreen({'screen':STRING});
  1. Call firebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, itemBundle)
gonative.firebaseAnalytics.event.viewItem({'data':JsonProductItem, 'currency': STRING, 'price': FLOAT});
// JsonProductItem is an encoded map of ProductItem*
// currency is the 3-letter currency code in upper-case
// price is the cost per item in the given Currency
  1. Call firebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_WISHLIST, bundle)
gonative.firebaseAnalytics.event.addToWishlist({'data':JsonProductItem, 'currency': STRING, 'price': FLOAT, 'quantity': INTEGER});
// JsonProductItem is an encoded map of ProductItem*
// currency is the 3-letter currency code in upper-case
// price is the cost per item in the given Currency
// quantity is the count of the product. It multiplies the price for the total amount.
  1. Call firebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, bundle)
gonative.firebaseAnalytics.event.addToCart({'data':JsonProductItem, 'currency': STRING, 'price': FLOAT, 'quantity': INTEGER});
// JsonProductItem is an encoded map of ProductItem*
// currency is the 3-letter currency code in upper-case
// price is the cost per item in the given Currency
// quantity is the count of the product. It multiplies the price for the total amount.
  1. Call firebaseAnalytics.logEvent(FirebaseAnalytics.Event.REMOVE_FROM_CART, bundle)
gonative.firebaseAnalytics.event.removeFromCart({'data':JsonProductItem, 'currency': STRING, 'price': FLOAT, 'quantity': INTEGER});
// JsonProductItem is an encoded map of ProductItem*
// currency is the 3-letter currency code in upper-case
// price is the cost per item in the given Currency
// quantity is the count of the product. It multiplies the price for the total amount.

*Note:
ProductItem may include the following fields. All fields are optional though it is recommended to provide at least an item_id or item_name.

String item_id
String item_name
String item_category
String item_variant
String item_brand
String item_list_name
String item_list_id
double price