Analytics Get Started - tuarua/Firebase-ANE GitHub Wiki

The contents of this page are based on the original Firebase Documentation

Google Analytics for Firebase collects usage and behavior data for your app. The SDK logs two primary types of information:

  • Events: What is happening in your app, such as user actions, system events, or errors.
  • User properties: Attributes you define to describe segments of your user base, such as language preference or geographic location.

Analytics automatically logs some events and user properties; you don't need to add any code to enable them.

Add Analytics to your app

import com.tuarua.firebase.AnalyticsANE;
analytics = AnalyticsANE.analytics;

Log events

After you have configured the FirebaseApp instance, you can begin to log events with the logEvent() method. You can explore the predefined events and parameters in the FirebaseAnalyticsEvent.as and FirebaseAnalyticsParam.as files.

The following example demonstrates how to log a suggested FirebaseAnalyticsEvent.SELECT_CONTENT event to indicate a user has clicked on a specific element in your app:

 var obj:Object = {};
obj[FirebaseAnalyticsParam.ITEM_ID] = "abc";
obj[FirebaseAnalyticsParam.ITEM_NAME] = "item name";
obj[FirebaseAnalyticsParam.CONTENT_TYPE] = "image";
analytics.logEvent(FirebaseAnalyticsEvent.SELECT_CONTENT, obj);