AWSMobileAnalyticsEvent Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | AWSMobileAnalyticsEvent.h |
Overview
Represents the visit or conversion event of an A/B test, or may also be used to collect useful information in your application.
The example below demonstrates how to record view and conversion events. The @"level1Complete"
event represents the view event,
and if the user makes a purchase, the code below records a @"level1UserBoughtUpgrade"
event as the conversion event.
// get the event client from insights instance
idAWSMobileAnalyticsEventClient eventClient = insights.eventClient;
// create the view event
id<AWSMobileAnalyticsEvent> level1Event = [eventClient createEventWithEventType:@"level1Complete"];
// record the view event
[eventClient recordEvent:level1Event];
// record if the user bought an upgrade (conversion)
if (userBoughtUpgrade) {
// create the conversion event
id<AWSMobileAnalyticsEvent> boughtUpgradeEvent = [eventClient createEventWithEventType:@"level1UserBoughtUpgrade"];
// record the conversion event
[eventClient recordEvent:boughtUpgradeEvent];
}
eventType
required method
Returns the name/type of this AWSMobileAnalyticsEvent
@property (nonatomic, readonly) NSString *eventType
Return Value
the name/type of this AWSMobileAnalyticsEvent
Declared In
AWSMobileAnalyticsEvent.h
– addAttribute:forKey:
required method
Adds an attribute to this AWSMobileAnalyticsEvent with the specified key. Only 40 attributes/metrics are allowed to be added to an AWSMobileAnalyticsEvent. If 40 attributes/metrics already exist on this AWSMobileAnalyticsEvent, the call is ignored.
- (void)addAttribute:(NSString *)theValue forKey:(NSString *)theKey
Parameters
theValue |
The value of the attribute. The value will be truncated if it exceeds 200 characters. |
---|---|
theKey |
The key of the attribute. The key will be truncated if it exceeds 50 characters. |
Declared In
AWSMobileAnalyticsEvent.h
– addMetric:forKey:
required method
Adds a metric to this AWSMobileAnalyticsEvent with the specified key. Only 40 attributes/metrics are allowed to be added to an AWSMobileAnalyticsEvent. If 40 attribute/metrics already exist on this AWSMobileAnalyticsEvent, the call is ignored.
- (void)addMetric:(NSNumber *)theValue forKey:(NSString *)theKey
Parameters
theValue |
The value of the metric. |
---|---|
theKey |
The key of the metric. The key will be truncated if it exceeds 50 characters. |
Declared In
AWSMobileAnalyticsEvent.h
– attributeForKey:
required method
Returns the value of the attribute with the specified key.
- (NSString *)attributeForKey:(NSString *)theKey
Parameters
theKey |
The key of the attribute to return |
---|
Return Value
The attribute with the specified key, or null if attribute does not exist
Declared In
AWSMobileAnalyticsEvent.h
– metricForKey:
required method
Returns the value of the metric with the specified key.
- (NSNumber *)metricForKey:(NSString *)theKey
Parameters
theKey |
The key of the metric to return |
---|
Return Value
The metric with the specified key, or null if metric does not exist
Declared In
AWSMobileAnalyticsEvent.h
– hasAttributeForKey:
required method
Determines if this AWSMobileAnalyticsEvent contains a specific attribute
- (BOOL)hasAttributeForKey:(NSString *)theKey
Parameters
theKey |
The key of the attribute |
---|
Return Value
YES if this AWSMobileAnalyticsEvent has an attribute with the specified key, NO otherwise
Declared In
AWSMobileAnalyticsEvent.h
– hasMetricForKey:
required method
Determines if this AWSMobileAnalyticsEvent contains a specific metric
- (BOOL)hasMetricForKey:(NSString *)theKey
Parameters
theKey |
The key of the metric |
---|
Return Value
YES if this AWSMobileAnalyticsEvent has a metric with the specified key, NO otherwise
Declared In
AWSMobileAnalyticsEvent.h
– allAttributes
required method
Returns an NSDictionary of all attributes contained within this AWSMobileAnalyticsEvent
- (NSDictionary *)allAttributes
Return Value
an NSDictionary of all attributes, where the attribute keys are the keys and the attribute values are the values
Declared In
AWSMobileAnalyticsEvent.h
– allMetrics
required method
Returns an NSDictionary of all metrics contained within this AWSMobileAnalyticsEvent
- (NSDictionary *)allMetrics
Return Value
an NSDictionary of all metrics, where the metric keys are the keys and the metric values are the values
Declared In
AWSMobileAnalyticsEvent.h