public class

Analytics

extends AirshipComponent
java.lang.Object
   ↳ com.urbanairship.AirshipComponent
     ↳ com.urbanairship.analytics.Analytics

Class Overview

This class is the primary interface to the Airship Analytics API.

Summary

[Expand]
Inherited Fields
From class com.urbanairship.AirshipComponent
Public Constructors
Analytics(Context context, PreferenceDataStore dataStore, AirshipRuntimeConfig runtimeConfig, PrivacyManager privacyManager, AirshipChannel channel, LocaleManager localeManager, PermissionsManager permissionsManager)
Public Methods
void addAnalyticsListener(AnalyticsListener analyticsListener)
Adds an AnalyticsListener for analytics events.
void addEvent(Event event)
Adds an analytics event.
AssociatedIdentifiers.Editor editAssociatedIdentifiers()
Edits the currently stored associated identifiers.
AssociatedIdentifiers getAssociatedIdentifiers()
Returns the device's current associated identifiers.
String getConversionSendId()
Returns the last stored send Id from when a push conversion was detected.
String getSessionId()
Gets the current environment Id.
boolean isAppInForeground()
Determines if the application is in the foreground.
boolean isEnabled()
Returns true if analyticsEnabled is set to true, and FEATURE_ANALYTICS is enabled, otherwise false.
void removeAnalyticsListener(AnalyticsListener analyticsListener)
Removes an AnalyticsListener for analytics events.
void setEnabled(boolean enabled)
This method is deprecated. Enable/disable by enabling FEATURE_ANALYTICS in PrivacyManager. This will call through to the privacy manager.
void trackScreen(String screen)
Initiates screen tracking for a specific app screen, must be called once per tracked screen.
void uploadEvents()
Uploads any pending events.
Protected Methods
void init()
Initialize the manager.
void tearDown()
Tear down the manager.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Analytics (Context context, PreferenceDataStore dataStore, AirshipRuntimeConfig runtimeConfig, PrivacyManager privacyManager, AirshipChannel channel, LocaleManager localeManager, PermissionsManager permissionsManager)

Public Methods

public void addAnalyticsListener (AnalyticsListener analyticsListener)

Adds an AnalyticsListener for analytics events.

Parameters
analyticsListener The AnalyticsListener.

public void addEvent (Event event)

Adds an analytics event.

Parameters
event The event to be triggered.

public AssociatedIdentifiers.Editor editAssociatedIdentifiers ()

Edits the currently stored associated identifiers. All changes made in the editor are batched, and not stored until you call apply(). Calling apply() on the editor will associate the identifiers with the device and add an event that will be sent up with other analytics events. See AssociatedIdentifiers.Editor

Returns
  • The AssociatedIdentifiers.Editor

public AssociatedIdentifiers getAssociatedIdentifiers ()

Returns the device's current associated identifiers.

Returns
  • The current associated identifiers.

public String getConversionSendId ()

Returns the last stored send Id from when a push conversion was detected.

Returns
  • A send Id String.

public String getSessionId ()

Gets the current environment Id.

Returns
  • A environment Id String.

public boolean isAppInForeground ()

Determines if the application is in the foreground.

Returns
  • true if the application is in the foreground, otherwise false.

public boolean isEnabled ()

Returns true if analyticsEnabled is set to true, and FEATURE_ANALYTICS is enabled, otherwise false.

Features that depend on analytics being enabled may not work properly if it's disabled (reports, region triggers, location segmentation, push to local time).

Returns
  • true if analytics is enabled, otherwise false.

public void removeAnalyticsListener (AnalyticsListener analyticsListener)

Removes an AnalyticsListener for analytics events.

Parameters
analyticsListener The AnalyticsListener.

public void setEnabled (boolean enabled)

This method is deprecated.
Enable/disable by enabling FEATURE_ANALYTICS in PrivacyManager. This will call through to the privacy manager.

Sets analytics enabled. When disabling analytics, any locally stored events will be deleted.

Features that depend on analytics being enabled may not work properly if it's disabled (reports, region triggers, location segmentation, push to local time).

Parameters
enabled true to enable analytics, false to disable.

public void trackScreen (String screen)

Initiates screen tracking for a specific app screen, must be called once per tracked screen.

Parameters
screen The screen's string identifier.

public void uploadEvents ()

Uploads any pending events. Events are batched and uploaded automatically to conserve battery life. Normally apps should not call this method directly.

Protected Methods

protected void init ()

Initialize the manager. Called in UAirship during takeoff.

protected void tearDown ()

Tear down the manager. Called in UAirship during land.