Titanium.Analytics
> Titanium.Analytics

Used for transmitting developer-defined Analytics events to the Appcelerator Analytics product.

The Analytics module can be used to supply additional context or application-specific information which can then be accessed during analysis using Analytics.

Use the featureEvent method to generate custom events that you can view through the Analytics product. You can specify a name for the feature event which is visible through Analytics.

NOTE The Analytics module lets you transmit some data that is stored, but not made accessible through the Analytics UI. To access this data, you must sign up for the optional raw data export service.

The following types of data are stored but not made available through the Analytics UI:

  • Navigation events.

  • Extra data added to feature events (the data parameter).

Viewing navigation events in the Analytics UI will be supported in a future version of the Analytics product. There is no plan to support the other event types, and they should not be used.

GDPR Compliance

The Ti.Analytics namespace in Titanium is GDPR compliant since SDK 7.2.0. End users should be able to opt out of Analytics using the optedOut property. If a user opted out from Analytics and you still call Analytics events, they will be ignored.

Note: This does not affect your app until you make use of the optedOut property. Once enabled for your users (e.g. by having a Titanium.UI.Switch in your settings), you should handle it within your app logic.

Examples

Custom Feature Event

This example shows how to send a feature event during an application session to indicate some feature that you would like to track was used.

Ti.Analytics.featureEvent('app.feature');

In this case, the Analytics product would show statistics about how many times the 'app.feature' event was generated.

  • 0.8
  • 0.8
  • 0.8
Defined By

Properties

apiName : Stringreadonly

The name of the API that this proxy corresponds to.

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Button returns Ti.UI.Button.

  • 3.2.0
  • 3.2.0
  • 3.2.0
Indicates if the proxy will bubble an event to its parent. ...

Indicates if the proxy will bubble an event to its parent.

Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.

Default: true

  • 3.0.0
  • 3.0.0
  • 3.0.0
Titanium.Analytics
lastEvent : Stringreadonly

JSON representation of the last Analytics event generated.

JSON representation of the last Analytics event generated.

LastEvent is the JSON version of the last event prepared to be sent to Appcelerator during the application's session. This value may be null or undefined if no such event was queued.

  • 3.1.2
  • 3.1.2
  • 3.1.2

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.

  • 3.6.0
Titanium.Analytics
optedOut : Boolean

Allows the user to opt out from Analytics during runtime to comply to GPDR.

Allows the user to opt out from Analytics during runtime to comply to GPDR.

Once opted out, no Analytics events will be sent anymore. If implemented to the end user, ensure to check if the user is opted out before trying to send an Analytics event. In case you do not guard the Analytics call, it will be ignored silently.

Here is an example of a guarded Analytics call:

if (!Ti.Analytics.optedOut) {
  Ti.Analytics.featureEvent('gdpr_rocks');
}

Read more about GDPR on the official website.

  • 7.2.0
  • 7.2.0
  • 7.2.0
Defined By

Methods

Titanium.Analytics
( type, name, [data] )removed
Sends a generic event for this application session. ...

Sends a generic event for this application session. Not displayed in Analytics UI.

This method has been removed since 3.3.0

Parameters

  • type : String

    Event type.

  • name : String

    Event name.

  • data : Object (optional)

    Extra data related to the event. Must be serializable as JSON.

Returns

  • void
Titanium.Analytics
( name, [data] ) : Number
Sends a feature event for this application session. ...

Sends a feature event for this application session.

From version "6.0.0", the JSON that is being sent will be validated. The JSON can have a maximum of 5 nested levels, 1000 serialised byte length, 25 keys per level and key length of up to 50 characters.

If this is successful, you will get a return number of 0. -1 is returned if it is a JSON Validation error. -2 is returned if Analytics is disabled.

Parameters

  • name : String

    Event name, displayed in Analytics UI.

  • data : Object (optional)

    Extra data related to the event. Must be serializable as JSON.

Returns

  • Number

    It returns 0 if it is successful. Otherwise, it is an error.

Titanium.Analytics
( events )
Sets a list of events that will not be sent to the Analytics server. ...

Sets a list of events that will not be sent to the Analytics server.

  • 4.1.0
  • 4.1.0
  • 4.1.0

Parameters

  • events : Array<String>

    List of events to be filtered.

Returns

  • void
Gets the value of the apiName property. ...

Gets the value of the apiName property.

  • 3.2.0
  • 3.2.0
  • 3.2.0

Returns

  • String
Gets the value of the bubbleParent property. ...

Gets the value of the bubbleParent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Returns

  • Boolean
Titanium.Analytics
( ) : String
Gets the value of the lastEvent property. ...

Gets the value of the lastEvent property.

  • 3.1.2
  • 3.1.2
  • 3.1.2

Returns

  • String
Gets the value of the lifecycleContainer property. ...

Gets the value of the lifecycleContainer property.

  • 3.6.0

Returns

Titanium.Analytics
( ) : Boolean
Gets the value of the optedOut property. ...

Gets the value of the optedOut property.

  • 7.2.0
  • 7.2.0
  • 7.2.0

Returns

  • Boolean
Titanium.Analytics
( from, to, [name], [data] )
Sends a navigation event for this application session. ...

Sends a navigation event for this application session. Not displayed in Analytics UI.

Parameters

  • from : String

    String describing the location the user navigated from.

  • to : String

    String describing the location the user navigated to.

  • name : String (optional)

    Event name.

  • data : Object (optional)

    Extra data related to the event. The object must be serializable as JSON.

Returns

  • void
Sets the value of the bubbleParent property. ...

Sets the value of the bubbleParent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Parameters

  • bubbleParent : Boolean

    New value for the property.

Returns

  • void
Sets the value of the lifecycleContainer property. ...

Sets the value of the lifecycleContainer property.

  • 3.6.0

Parameters

Returns

  • void
Titanium.Analytics
( optedOut )
Sets the value of the optedOut property. ...

Sets the value of the optedOut property.

  • 7.2.0
  • 7.2.0
  • 7.2.0

Parameters

  • optedOut : Boolean

    New value for the property.

Returns

  • void
Titanium.Analytics
( name, [data] )removed
Sends a settings event for this application session. ...

Sends a settings event for this application session. Not displayed in Analytics UI.

This method has been removed since 3.3.0

Parameters

  • name : String

    Event name.

  • data : Object (optional)

    Extra data related to the event. Must be serializable as JSON.

Returns

  • void
Titanium.Analytics
( name, start, stop, duration, [data] )removed
Send a timed event for this application session. ...

Send a timed event for this application session. Not displayed in Analytics UI.

This method has been removed since 3.3.0

Parameters

  • name : String

    Event name.

  • start : Date

    Event start as a Date object.

  • stop : Date

    Event end as a Date object.

  • duration : Number

    Event duration.

  • data : Object (optional)

    Extra data related to the event. Must be serializable as JSON.

Returns

  • void
Titanium.Analytics
( name, [data] )removed
Sends a user event for this application session. ...

Sends a user event for this application session. Not displayed in Analytics UI.

This method has been removed since 3.3.0

Parameters

  • name : String

    Event name.

  • data : Object (optional)

    Extra data related to the event. Must be serializable as JSON.

Returns

  • void