Protocols
The following protocols are available globally.
-
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 id
eventClient = insights.eventClient; // create the view event id
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
boughtUpgradeEvent = [eventClient createEventWithEventType:@“level1UserBoughtUpgrade”]; // record the conversion event [eventClient recordEvent:boughtUpgradeEvent];
}
See moreDeclaration
Objective-C
@protocol AWSMobileAnalyticsEvent <NSObject>
Swift
protocol AWSMobileAnalyticsEvent : 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.
See moreDeclaration
Objective-C
@protocol AWSMobileAnalyticsEventClient <NSObject>
Swift
protocol AWSMobileAnalyticsEventClient : NSObjectProtocol
-
The AWSMobileAnalyticsOptions protocol is implemented by all classes that can provide options such as enablement of event collection and allowance of event delivery on WAN within the SDK.
See moreDeclaration
Objective-C
@protocol AWSMobileAnalyticsOptions <NSObject>
Swift
protocol AWSMobileAnalyticsOptions : NSObjectProtocol