com.amazonaws.mobileconnectors.amazonmobileanalytics
Interface AnalyticsEvent


public interface AnalyticsEvent

Represents the any useful action you wish to record within your application

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);
    }
 


Method Summary
 void addAttribute(java.lang.String name, java.lang.String value)
          Adds an attribute to this AnalyticsEvent with the specified key.
 void addMetric(java.lang.String name, java.lang.Double value)
          Adds a metric to this AnalyticsEvent with the specified key.
 java.util.Map<java.lang.String,java.lang.String> getAllAttributes()
          Returns a map of all attributes contained within this AnalyticsEvent
 java.util.Map<java.lang.String,java.lang.Double> getAllMetrics()
          Returns a map of all metrics contained within this AnalyticsEvent
 java.lang.String getAttribute(java.lang.String name)
          Returns the value of the attribute with the specified name.
 java.lang.String getEventType()
          Returns the name/type of this AnalyticsEvent
 java.lang.Double getMetric(java.lang.String name)
          Returns the value of the metric with the specified name.
 boolean hasAttribute(java.lang.String attributeName)
          Determines if this AnalyticsEvent contains a specific attribute
 boolean hasMetric(java.lang.String metricName)
          Determines if this AnalyticsEvent contains a specific metric.
 AnalyticsEvent withAttribute(java.lang.String name, java.lang.String value)
          Adds an attribute to this AnalyticsEvent with the specified key.
 AnalyticsEvent withMetric(java.lang.String name, java.lang.Double value)
          Adds a metric to this AnalyticsEvent with the specified key.
 

Method Detail

addAttribute

void addAttribute(java.lang.String name,
                  java.lang.String value)
Adds an attribute to this 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.

Parameters:
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.

hasAttribute

boolean hasAttribute(java.lang.String attributeName)
Determines if this AnalyticsEvent contains a specific attribute

Parameters:
attributeName - The name of the attribute
Returns:
true if this AnalyticsEvent has an attribute with the specified name, false otherwise

addMetric

void addMetric(java.lang.String name,
               java.lang.Double value)
Adds a metric to this 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.

Parameters:
name - The name of the metric. The name will be truncated if it exceeds 50 characters.
value - The value of the metric.

hasMetric

boolean hasMetric(java.lang.String metricName)
Determines if this AnalyticsEvent contains a specific metric.

Parameters:
metricName - The name of the metric
Returns:
true if this AnalyticsEvent has a metric with the specified name, false otherwise

getEventType

java.lang.String getEventType()
Returns the name/type of this AnalyticsEvent

Returns:
the name/type of this AnalyticsEvent

getAttribute

java.lang.String getAttribute(java.lang.String name)
Returns the value of the attribute with the specified name.

Parameters:
name - The name of the attribute to return
Returns:
The attribute with the specified name, or null if attribute does not exist

getMetric

java.lang.Double getMetric(java.lang.String name)
Returns the value of the metric with the specified name.

Parameters:
name - The name of the metric to return
Returns:
The metric with the specified name, or null if metric does not exist

withAttribute

AnalyticsEvent withAttribute(java.lang.String name,
                             java.lang.String value)
Adds an attribute to this 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.

Parameters:
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.
Returns:
The same AnalyticsEvent instance is returned to allow for method chaining.

withMetric

AnalyticsEvent withMetric(java.lang.String name,
                          java.lang.Double value)
Adds a metric to this 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.

Parameters:
name - The name of the metric. The name will be truncated if it exceeds 50 characters.
value - The value of the metric.
Returns:
The same AnalyticsEvent instance is returned to allow for method chaining.

getAllAttributes

java.util.Map<java.lang.String,java.lang.String> getAllAttributes()
Returns a map of all attributes contained within this AnalyticsEvent

Returns:
a map of all attributes, where the attribute names are the keys and the attribute values are the values

getAllMetrics

java.util.Map<java.lang.String,java.lang.Double> getAllMetrics()
Returns a map of all metrics contained within this AnalyticsEvent

Returns:
a map of all metrics, where the metric names are the keys and the metric values are the values


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.