public interface AnalyticsEvent
The example below demonstrates how to record events.
// get the event client from your amazon MobileAnalyticsManager instance EventClient eventClient = mobileAnalyticsManager.getEventClient(); // create and record the view event Event level1CompleteEvent = eventClient.createEvent("level1Complete"); eventClient.recordEvent(level1CompleteEvent); // record if the user bought an upgrade (conversion) if (userBoughtUpgrade) { Event level1UserBoughtUpgradeEvent = eventClient.createEvent("level1UserBoughtUpgrade"); eventClient.recordEvent(level1UserBoughtUpgradeEvent); }
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String name,
String value)
Adds an attribute to this
AnalyticsEvent with the specified key. |
void |
addMetric(String name,
Double value)
Adds a metric to this
AnalyticsEvent with the specified key. |
Map<String,String> |
getAllAttributes()
Returns a map of all attributes contained within this
AnalyticsEvent |
Map<String,Double> |
getAllMetrics()
Returns a map of all metrics contained within this
AnalyticsEvent |
String |
getAttribute(String name)
Returns the value of the attribute with the specified name.
|
String |
getEventType()
Returns the name/type of this
AnalyticsEvent |
Double |
getMetric(String name)
Returns the value of the metric with the specified name.
|
boolean |
hasAttribute(String attributeName)
Determines if this
AnalyticsEvent contains a specific attribute |
boolean |
hasMetric(String metricName)
Determines if this
AnalyticsEvent contains a specific metric. |
AnalyticsEvent |
withAttribute(String name,
String value)
Adds an attribute to this
AnalyticsEvent with the specified key. |
AnalyticsEvent |
withMetric(String name,
Double value)
Adds a metric to this
AnalyticsEvent with the specified key. |
void addAttribute(String name, String value)
AnalyticsEvent
with the specified key. Only 40 attributes/metrics
are allowed to be added to an Event. If 40 attribute/metrics already exist on this Event, the call may be ignored.name
- The name of the attribute. The name will be truncated if it exceeds 50 characters.value
- The value of the attribute. The value will be truncated if it exceeds 200 characters.boolean hasAttribute(String attributeName)
AnalyticsEvent
contains a specific attributeattributeName
- The name of the attributeAnalyticsEvent
has an attribute with the specified name, false otherwisevoid addMetric(String name, Double value)
AnalyticsEvent
with the specified key. Only 40 attributes/metrics
are allowed to be added to an Event. If 50 attribute/metrics already exist on this Event, the call may be ignored.name
- The name of the metric. The name will be truncated if it exceeds 50 characters.value
- The value of the metric.boolean hasMetric(String metricName)
AnalyticsEvent
contains a specific metric.metricName
- The name of the metricAnalyticsEvent
has a metric with the specified name, false otherwiseString getEventType()
AnalyticsEvent
AnalyticsEvent
String getAttribute(String name)
name
- The name of the attribute to returnDouble getMetric(String name)
name
- The name of the metric to returnAnalyticsEvent withAttribute(String name, String value)
AnalyticsEvent
with the specified key. Only 40 attributes/metrics
are allowed to be added to an AnalyticsEvent
. If 40 attribute/metrics already exist on this AnalyticsEvent
, the call may be ignored.name
- The name of the attribute. The name will be truncated if it exceeds 50 characters.value
- The value of the attribute. The value will be truncated if it exceeds 200 characters.AnalyticsEvent
instance is returned to allow for method chaining.AnalyticsEvent withMetric(String name, Double value)
AnalyticsEvent
with the specified key. Only 40 attributes/metrics
are allowed to be added to an AnalyticsEvent
. If 40 attribute/metrics already exist on this AnalyticsEvent
, the call may be ignored.name
- The name of the metric. The name will be truncated if it exceeds 50 characters.value
- The value of the metric.AnalyticsEvent
instance is returned to allow for method chaining.Map<String,String> getAllAttributes()
AnalyticsEvent
Map<String,Double> getAllMetrics()
AnalyticsEvent
Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.