new Client(options)
Parameters:
| Name | Type | Description |
|---|---|---|
options |
AMA.Client.Options | A configuration map for the AMA.Client |
- Source:
Returns:
A new instance of the Mobile Analytics Mid Level Client
Methods
-
createEvent(eventType, session, attributes=, metrics=) → {AMA.Event}
-
AMA.Client.createEvent
Parameters:
Name Type Argument Description eventTypestring Custom Event Type to be displayed in Console sessionAMA.Session Session Object (required for use within console) Properties
Name Type Description idstring Identifier for current session startTimestampstring Timestamp that indicates the start of the session attributes=<optional>
Custom attributes metrics=<optional>
Custom metrics - Source:
Returns:
- Type
- AMA.Event
-
pushEvent(event) → {int}
-
AMA.Client.pushEvent
Parameters:
Name Type Description eventAMA.Event event to be pushed onto queue - Source:
Returns:
Index of event in outputs.events- Type
- int
-
recordEvent(eventType, session, attributes=, metrics=) → {AMA.Event}
-
Helper to record events, will automatically submit if the events exceed batchSizeLimit
Parameters:
Name Type Argument Description eventTypestring Custom event type name sessionAMA.Session Session object attributes=AMA.Client.Attributes <optional>
Custom attributes metrics=AMA.Client.Metrics <optional>
Custom metrics - Source:
Returns:
The event that was recorded- Type
- AMA.Event
-
recordMonetizationEvent(session, monetizationDetails, attributes=, metrics=) → {event}
-
recordMonetizationEvent
Parameters:
Name Type Argument Description sessionmonetizationDetailsObject Details about Monetization Event Properties
Name Type Description currencystring ISO Currency of event productIdstring Product Id of monetization event quantitynumber Quantity of product in transaction pricestring | number Price of product either ISO formatted string, or number with associated ISO Currency attributes=AMA.Client.Attributes <optional>
Custom attributes metrics=AMA.Client.Metrics <optional>
Custom metrics - Source:
Returns:
The event that was recorded- Type
- event
-
submitEvents(options=) → {Array}
-
submitEvents
Parameters:
Name Type Argument Default Description options=Object <optional>
options for submitting events options.clientContextObject <optional>
this.options.clientContext clientContext to submit with defaults to options.clientContext options.submitCallbackSubmitCallback <optional>
this.options.submitCallback Callback function that is executed when events are successfully submitted - Source:
Returns:
Array of batch indices that were submitted- Type
- Array
Type Definitions
-
Attributes
-
A collection of key-value pairs that give additional context to the event. The key-value pairs are specified by the developer.
Type:
- object
- Source:
-
Event
-
A JSON object representing an event occurrence in your app and consists of the following:
Type:
- object
- Source:
Properties:
Name Type Argument Description eventTypestring A name signifying an event that occurred in your app. This is used for grouping and aggregating like events together for reporting purposes. timestampstring The time the event occurred in ISO 8601 standard date time format. For example, 2014-06-30T19:07:47.885Z attributes=AMA.Client.Attributes <optional>
A collection of key-value pairs that give additional context to the event. The key-value pairs are specified by the developer. This collection can be empty or the attribute object can be omitted. metrics=AMA.Client.Metrics <optional>
A collection of key-value pairs that gives additional measurable context to the event. The pairs specified by the developer. sessionAMA.Session Describes the session. Session information is required on ALL events. -
Logger
-
Uses Javascript Style log levels, one function for each level. Basic usage is to pass the console object which will output directly to browser developer console.
- Source:
Properties:
Name Type Argument Description log=function <optional>
Logger for client log level messages info=function <optional>
Logger for interaction level messages warn=function <optional>
Logger for warn level messages error=function <optional>
Logger for error level messages -
Metrics
-
A collection of key-value pairs that gives additional measurable context to the event. The pairs specified by the developer.
Type:
- object
- Source:
-
Options
-
- Source:
Properties:
Name Type Argument Default Description appIdstring The Application ID from the Amazon Mobile Analytics Console apiVersionstring <optional>
2014-06-05 The version of the Mobile Analytics API to submit to. providerobject <optional>
AWS.config.credentials Credentials to use for submitting events. **Never check in credentials to source control. autoSubmitEventsboolean <optional>
true Automatically Submit Events, Default: true autoSubmitIntervalnumber <optional>
10000 Interval to try to submit events in ms, Default: 10s batchSizeLimitnumber <optional>
256000 Batch Size in Bytes, Default: 256Kb submitCallback=AMA.Client.SubmitCallback <optional>
Callback function that is executed when events are successfully submitted globalAttributes=AMA.Client.Attributes <optional>
Attribute to be applied to every event, may be overwritten with a different value when recording events. globalMetrics=AMA.Client.Metrics <optional>
Metric to be applied to every event, may be overwritten with a different value when recording events. clientIdstring <optional>
GUID() A unique identifier representing this installation instance of your app. This will be managed and persisted by the SDK by default. appTitle=string <optional>
The title of your app. For example, My App. appVersionName=string <optional>
The version of your app. For example, V2.0. appVersionCode=string <optional>
The version code for your app. For example, 3. appPackageName=string <optional>
The name of your package. For example, com.example.my_app. platform=string <optional>
The operating system of the device. For example, iPhoneOS. plaformVersion=string <optional>
The version of the operating system of the device. For example, 4.0.4. model=string <optional>
The model of the device. For example, Nexus. make=string <optional>
The manufacturer of the device. For example, Samsung. locale=string <optional>
The locale of the device. For example, en_US. logger=AMA.Client.Logger <optional>
Object of logger functions storage=AMA.Storage <optional>
Storage client to persist events, will create a new AMA.Storage if not provided clientOptions=Object <optional>
Low level client options to be passed to the AWS.MobileAnalytics low level SDK -
SubmitCallback(err, data, batchId)
-
Parameters:
Name Type Description errError dataNull batchIdstring - Source: