AWSMobileAnalyticsEventClient
Objective-C
@protocol AWSMobileAnalyticsEventClient <NSObject>
Swift
protocol AWSMobileAnalyticsEventClient : NSObjectProtocol
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: // get the event client from insights instance
id<AWSMobileAnalyticsEventClient> 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];
}
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: // get the event client from insights instance
id<AWSMobileAnalyticsEventClient> eventClient = insights.eventClient;
// submit events to the website
[eventClient submitEvents];
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.
-
Undocumented
Declaration
Objective-C
- (void)addGlobalAttribute:(NSString *)theValue forKey:(NSString *)theKey;
Swift
func addGlobalAttribute(_ theValue: String!, forKey theKey: String!)
-
Undocumented
Declaration
Objective-C
- (void)addGlobalAttribute:(NSString *)theValue forKey:(NSString *)theKey forEventType:(NSString *)theEventType;
Swift
func addGlobalAttribute(_ theValue: String!, forKey theKey: String!, forEventType theEventType: String!)
-
Undocumented
Declaration
Objective-C
- (void)addGlobalMetric:(NSNumber *)theValue forKey:(NSString *)theKey;
Swift
func addGlobalMetric(_ theValue: NSNumber!, forKey theKey: String!)
-
Undocumented
Declaration
Objective-C
- (void)addGlobalMetric:(NSNumber *)theValue forKey:(NSString *)theKey forEventType:(NSString *)theEventType;
Swift
func addGlobalMetric(_ theValue: NSNumber!, forKey theKey: String!, forEventType theEventType: String!)
-
Undocumented
Declaration
Objective-C
- (void)removeGlobalAttributeForKey:(NSString*) theKey;
Swift
func removeGlobalAttribute(forKey theKey: String!)
-
Undocumented
Declaration
Objective-C
- (void)removeGlobalAttributeForKey:(NSString*) theKey forEventType:(NSString*) theEventType;
Swift
func removeGlobalAttribute(forKey theKey: String!, forEventType theEventType: String!)
-
Undocumented
Declaration
Objective-C
- (void)removeGlobalMetricForKey:(NSString*) theKey;
Swift
func removeGlobalMetric(forKey theKey: String!)
-
Undocumented
Declaration
Objective-C
- (void)removeGlobalMetricForKey:(NSString*) theKey forEventType:(NSString*) theEventType;
Swift
func removeGlobalMetric(forKey theKey: String!, forEventType theEventType: String!)
-
Undocumented
Declaration
Objective-C
- (void)recordEvent:(id<AWSMobileAnalyticsEvent>)theEvent;
Swift
func record(_ theEvent: AWSMobileAnalyticsEvent!)
-
Undocumented
Declaration
Objective-C
- (id<AWSMobileAnalyticsEvent>)createEventWithEventType:(NSString *)theEventType;
Swift
func createEvent(withEventType theEventType: String!) -> AWSMobileAnalyticsEvent!
-
Undocumented
Declaration
Objective-C
- (void)submitEvents;
Swift
func submitEvents()