AWSMobileAnalyticsEventClient Protocol Reference

Conforms to NSObject
Declared in AWSMobileAnalyticsEventClient.h

Overview

AWSMobileAnalyticsEventClient is the entry point into the Mobile Analytics SDK where AWSMobileAnalyticsEvent objects are created, recorded, and submitted to the Mobile Analytics Website.

Recording Events

The example below demonstrates how to create and record events after retrieving an AIVariation. In this example, the developer records the \@"level1Complete" event to represent a view, and if the user makes a purchase, the developer records a \@"level1UserBoughtUpgrade" to represent a conversion.

Example: @code // get the event client from insights instance id eventClient = insights.eventClient;

// create the view event idAWSMobileAnalyticsEvent 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 idAWSMobileAnalyticsEvent boughtUpgradeEvent = [eventClient createEventWithEventType:@“level1UserBoughtUpgrade”];

// record the conversion event [eventClient recordEvent:boughtUpgradeEvent]; } @endcode

Submitting Events

The example below demonstrates how to submit events to the Mobile Analytics Website. The SDK will automatically attempt to submit events when the application goes into the background. If you want to explicitly submit events you can invoke the AWSMobileAnalyticsEventClient::submitEvents selector to submit events to the Mobile Analytics Website in a background thread.

Example: @code // get the event client from insights instance id eventClient = insights.eventClient;

// submit events to the website [eventClient submitEvents]; @endcode The SDK ensures that you do not submit events too frequently. If you try submitting events within one minute of a previous submission, the submission request will be ignored.

– addGlobalAttribute:forKey: required method

Adds the specified attribute to all subsequent recorded events.

- (void)addGlobalAttribute:(NSString *)theValue forKey:(NSString *)theKey

Parameters

theValue

the value of the attribute

theKey

the name of the attribute to add

Declared In

AWSMobileAnalyticsEventClient.h

– addGlobalAttribute:forKey:forEventType: required method

Adds the specified attribute to all subsequent recorded events with the specified event type.

- (void)addGlobalAttribute:(NSString *)theValue forKey:(NSString *)theKey forEventType:(NSString *)theEventType

Parameters

theValue

the value of the attribute

theKey

the name of the attribute to add

theEventType

the type of events to add the attribute to

Declared In

AWSMobileAnalyticsEventClient.h

– addGlobalMetric:forKey: required method

Adds the specified metric to all subsequent recorded events.

- (void)addGlobalMetric:(NSNumber *)theValue forKey:(NSString *)theKey

Parameters

theValue

the value of the metric

theKey

the name of the metric to add

Declared In

AWSMobileAnalyticsEventClient.h

– addGlobalMetric:forKey:forEventType: required method

Adds the specified metric to all subsequent recorded events with the specified event type.

- (void)addGlobalMetric:(NSNumber *)theValue forKey:(NSString *)theKey forEventType:(NSString *)theEventType

Parameters

theValue

the value of the metric

theKey

the name of the metric to add

theEventType

the type of events to add the metric to

Declared In

AWSMobileAnalyticsEventClient.h

– removeGlobalAttributeForKey: required method

Removes the specified attribute. All subsequent recorded events will no longer have this global attribute.

- (void)removeGlobalAttributeForKey:(NSString *)theKey

Parameters

theKey

the key of the attribute to remove

Declared In

AWSMobileAnalyticsEventClient.h

– removeGlobalAttributeForKey:forEventType: required method

Removes the specified attribute. All subsequent recorded events with the specified event type will no longer have this global attribute.

- (void)removeGlobalAttributeForKey:(NSString *)theKey forEventType:(NSString *)theEventType

Parameters

theKey

the key of the attribute to remove

theEventType

the type of events to remove the attribute from

Declared In

AWSMobileAnalyticsEventClient.h

– removeGlobalMetricForKey: required method

Removes the specified metric. All subsequent recorded events will no longer have this global metric.

- (void)removeGlobalMetricForKey:(NSString *)theKey

Parameters

theKey

the key of the metric to remove

Declared In

AWSMobileAnalyticsEventClient.h

– removeGlobalMetricForKey:forEventType: required method

Removes the specified metric. All subsequent recorded events with the specified event type will no longer have this global metric.

- (void)removeGlobalMetricForKey:(NSString *)theKey forEventType:(NSString *)theEventType

Parameters

theKey

the key of the metric to remove

theEventType

the type of events to remove the metric from

Declared In

AWSMobileAnalyticsEventClient.h

– recordEvent: required method

Records the specified AWSMobileAnalyticsEvent to the local filestore

- (void)recordEvent:(id<AWSMobileAnalyticsEvent>)theEvent

Parameters

theEvent

The AWSMobileAnalyticsEvent to persist

Declared In

AWSMobileAnalyticsEventClient.h

– createEventWithEventType: required method

Create an AWSMobileAnalyticsEvent with the specified theEventType

- (id<AWSMobileAnalyticsEvent>)createEventWithEventType:(NSString *)theEventType

Parameters

theEventType

the type of event to create

Return Value

an AWSMobileAnalyticsEvent with the specified event type

Declared In

AWSMobileAnalyticsEventClient.h

– submitEvents required method

Submits all recorded events to the Mobile Analytics Website. If you try to submit events within one minute of a previous submission, the submission request will be ignored. See AWSMobileAnalyticsOptions for customizing which Internet connection the SDK can submit on. Events are automatically submitted when the application goes into the background.

- (void)submitEvents

Declared In

AWSMobileAnalyticsEventClient.h