Packagecom.myflashlab.air.extensions.firebase.analytics
Classpublic class FirebaseAnalytics
InheritanceFirebaseAnalytics Inheritance Object

The top level Firebase Analytics singleton that provides methods for logging events and setting user properties.

NOTE: Make sure you are initializing this class by calling FirebaseAnalytics.init();



Public Properties
 PropertyDefined By
  analyticsCollectionEnabled : Boolean
[static] [write-only] Sets whether analytics collection is enabled for this app on this device.
FirebaseAnalytics
  minimumSessionDuration : Number
[static] [write-only] (Deprecated, sessions start as soon as app comes to foreground.
FirebaseAnalytics
  sessionTimeoutDuration : Number
[static] [write-only] Sets the duration of inactivity that terminates the current session.
FirebaseAnalytics
  userId : String
[static] [write-only] Sets the user ID property.
FirebaseAnalytics
Public Methods
 MethodDefined By
  
getAppInstanceID($onResult:Function):void
[static] The unique ID for this instance of the application.
FirebaseAnalytics
  
init():void
[static] Initializes the singleton FirebaseAnalytics interface.
FirebaseAnalytics
  
logEvent($event:String, $params:AnalyticsParam):void
[static] Logs an app event.
FirebaseAnalytics
  
[static] Clears all analytics data for this app from the device and resets the app instance id.
FirebaseAnalytics
  
setScreen($screenName:String = null, $screenClass:String = null):void
[static] Sets the current screen name, which specifies the current visual context in your app.
FirebaseAnalytics
  
setUserProperty($name:String, $value:String):void
[static] Sets a user property to a given value.
FirebaseAnalytics
Public Constants
 ConstantDefined By
  EXTENSION_ID : String = com.myflashlab.air.extensions.firebase.analytics
[static]
FirebaseAnalytics
  VERSION : String = 9.9.0
[static]
FirebaseAnalytics
Property Detail
analyticsCollectionEnabledproperty
analyticsCollectionEnabled:Boolean  [write-only]

Sets whether analytics collection is enabled for this app on this device. This setting is persisted across app sessions. By default it is enabled.


Implementation
    public static function set analyticsCollectionEnabled(value:Boolean):void
minimumSessionDurationproperty 
minimumSessionDuration:Number  [write-only]

(Deprecated, sessions start as soon as app comes to foreground. more info here: https://firebase.googleblog.com/2018/12/new-changes-sessions-user-engagement.html Sets the minimum engagement time required before starting a session. The default value is 10000 (10 seconds).


Implementation
    public static function set minimumSessionDuration(value:Number):void
sessionTimeoutDurationproperty 
sessionTimeoutDuration:Number  [write-only]

Sets the duration of inactivity that terminates the current session. The default value is 1800000 (30 minutes).


Implementation
    public static function set sessionTimeoutDuration(value:Number):void
userIdproperty 
userId:String  [write-only]

Sets the user ID property. This feature must be used in accordance with Google's Privacy Policy (https://www.google.com/policies/privacy).

Setting the ID to null removes the user ID.


Implementation
    public static function set userId(value:String):void
Method Detail
getAppInstanceID()method
public static function getAppInstanceID($onResult:Function):void

The unique ID for this instance of the application.

Parameters

$onResult:Function

init()method 
public static function init():void

Initializes the singleton FirebaseAnalytics interface.

logEvent()method 
public static function logEvent($event:String, $params:AnalyticsParam):void

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 AnalyticsEvent and/or AnalyticsParam is recommended for optimal reporting.

Parameters

$event:String — The name of the event. Should contain 1 to 40 alphanumeric characters or underscores. The name must start with an alphabetic character. Some event names are reserved. See AnalyticsEvent for the list of reserved event names. The "firebase_" prefix is reserved and should not be used. Note that event names are case-sensitive and that logging two events whose names differ only in case will result in two distinct events.
 
$params:AnalyticsParam — The map of event parameters. Passing null indicates that the event has no parameters. Parameter names can be up to 100 characters long and must start with an alphabetic character and contain only alphanumeric characters and underscores. Only String and Number param types are supported. String parameter values can be up to 36 characters long. The "firebase_" prefix is reserved and should not be used for parameter names.

See also

resetAnalyticsData()method 
public static function resetAnalyticsData():void

Clears all analytics data for this app from the device and resets the app instance id.

setScreen()method 
public static function setScreen($screenName:String = null, $screenClass:String = null):void

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.

Note that screen reporting is enabled automatically on the native side. The main Activity on Android and the main UIViewControl on iOS will be reported by default because AIR apps use only one main native window. To be able to report screen changes in your AIR app, this method will help you.

NOTE: The screen name and screen class remain in effect until the current UIViewController or Activity changes or a new call to setScreen is made.

Parameters

$screenName:String (default = null) — The name of the current screen. Should contain 1 to 100 characters. Set to null to clear the current screen name.
 
$screenClass:String (default = null) — The name of the screen class. Should contain 1 to 100 characters. By default this is the class name of the current UIViewController/Activity. Set to null to revert to the default class name.

setUserProperty()method 
public static function setUserProperty($name:String, $value:String):void

Sets a user property to a given value. Up to 25 user property names are supported.

A UserProperty is an attribute that describes the app-user. By supplying UserProperties, you can later analyze different behaviors of various segments of your user base. You may supply up to 25 unique UserProperties per app, and you can use the name and value of your choosing for each one. UserProperty names can be up to 24 characters long, may only contain alphanumeric characters and underscores ("_"), and must start with an alphabetic character. UserProperty values can be up to 36 characters long. The "firebase_" prefix is reserved and should not be used.

NOTE: The following user property names are reserved and cannot be used:

Parameters

$name:String — The name of the user property to set. Should contain 1 to 24 alphanumeric characters or underscores and must start with an alphabetic character. The "firebase_" prefix is reserved and should not be used for user property names.
 
$value:String — The value of the user property. Values can be up to 36 characters long. Setting the value to null removes the user property.

Constant Detail
EXTENSION_IDConstant
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.firebase.analytics

VERSIONConstant 
public static const VERSION:String = 9.9.0