Class: Analytics

Analytics


new Analytics()

Class that provides analytics capabilities.

Class that provides analytics capabilities. Callers should use MobileBackend's analytics property.
Source:

Methods


endSession(successCallback, errorCallback)

Ends a session if one exists.

Ends a session if one exists.
Parameters:
Name Type Argument Description
successCallback Analytics~successCallback <optional>
Callback invoked on success (deprecated use promises instead).
errorCallback Analytics~errorCallback <optional>
Callback invoked on error (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(Undefined|NetworkResponse)>

flush(successCallback, errorCallback)

Uploads all events to the service if the device is online or caches them locally until the device goes online, at which point they will be uploaded.

Uploads all events to the service if the device is online or caches them locally until the device goes online, at which point they will be uploaded. If a session is in progress it will end.
Parameters:
Name Type Argument Description
successCallback Analytics~successCallback <optional>
Callback invoked on success (deprecated use promises instead).
errorCallback Analytics~errorCallback <optional>
Callback invoked on error (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(Object|NetworkResponse)>

getSessionId()

Returns session ID for current session.

Returns session ID for current session.
Source:
Returns:
Type
String

logEvent(event)

Writes out an analytics event.

Writes out an analytics event. It will implicitly call startSession(), which will add a new event to the list of events for Oracle Mobile Cloud Service to consume
Parameters:
Name Type Description
event AnalyticsEvent The event to log.
Source:
Returns:
The AnalyticsEvent instance that was logged.
Type
AnalyticsEvent
Example
event: "GettingStartedJSEvent"

logNamedEvent(name)

Creates a new analytics event with the given name.

Creates a new analytics event with the given name.
Parameters:
Name Type Description
name String The name of the event.
Source:
Returns:
The AnalyticsEvent instance that was logged.
Type
AnalyticsEvent

startSession()

Starts a new session.

Starts a new session. If one is in progress, then a new session will not be created.
Source:

Type Definitions


errorCallback(statusCode, message)

Callback invoked on error.

Callback invoked on error.
Parameters:
Name Type Description
statusCode Number Any HTTP status code returned from the server, if available.
message String The HTTP payload from the server, if available, or an error message.
Deprecated:
  • Use promises instead
Source:

successCallback()

Callback invoked after successfully flushing analytics events.

Callback invoked after successfully flushing analytics events.
Deprecated:
  • Use promises instead
Source: