Start and End Session Frames
You can use the SessionFrame API to create session frames that will appear in the session activity. Session frames provide context for what the user is doing during a session. With the API, you can improve the names of user screens and chronicle user flows within a business context.
Use Cases
The following are common use cases for the SessionFrame API.
- One ViewController performs multiple functions and you want more granular tracking of the individual functions.
- A user flow spans multiple ViewController or user interactions. For example, you could use the API to create the session frames "Login", "Product Selection", and "Purchase" to chronicle the user flow for purchases.
- You want to capture dynamic information based on user interactions to name session frames, such as an order ID.
SessionFrame API
- Objective-C
-
Class Method Description ADEumInstrumentation + (ADEumSessionFrame *)startSessionFrame:(NSString *)nameUse this to start and name your session frame. Naming session frames enable you to easily identify and track the frames in the Sessions Dialog.
ADEumSessionFrame - (void)updateName:(NSString *)name Rename the session frame name. You call this method from the ADEumSessionFrame object returned from startSessionFrame.
ADEumSessionFrame - (void)end End the session frame. You call this method from the ADEumSessionFrame object returned from startSessionFrame.
- Swift
-
Class Method Description ADEumInstrumentation startSessionFrame(_ name: String?) -> ADEumSessionFrameUse this to start and name your session frame. Naming session frames enable you to easily identify and track the frames in theSessions Dialog. ADEumSessionFrame
updateName(_ name: String?)Rename the session frame name. You call this method from the ADEumSessionFrame object returned from startSessionFrame. ADEumSessionFrame end() End the session frame. You call this method from the ADEumSessionFrame object returned from startSessionFrame.
Session Frame Example
- Objective-C
-
#import "ADEumSessionFrame.h" ... @property (nonatomic, strong) ADEumSessionFrame *checkoutSessionFrame; - (IBAction)checkoutCartButtonClicked:(id)sender { // The user starting to check out starts when the user clicks the checkout button // this may be after they have updated quantities of items in their cart, etc. checkoutSessionFrame = [ADEumInstrumentation startSessionFrame:@"Checkout"]; } - (IBAction)confirmOrderButtonClicked:(id)sender { // Once they have confirmed payment info and shipping information, and they // are clicking the "Confirm" button to start the backend process of checking out // we may know more information about the order itself, such as an Order ID. NSString *newSessionName = [NSString stringWithFormat:@"Checkout: Order ID %@",orderId]; [checkoutSessionFrame updateName:newSessionName]; } - (void)processOrderCompleted { // Once the order is processed, the user is done "checking out" so we end // the session frame [checkoutSessionFrame end]; checkoutSessionFrame = nil; } - (void)checkoutCancelled { // If they cancel or go back, you'll want to end the session frame also, or else // it will be left open and appear to have never ended. [checkoutSessionFrame end]; checkoutSessionFrame = nil; } - Swift
-
import ADEumSessionFrame ... var checkoutSessionFrame: ADEumSessionFrame? @IBAction func checkoutCartButtonClicked(_ sender: UIButton) { // The check out starts when the user clicks the checkout button. // This may be after they have updated quantities of items in their cart, etc. checkoutSessionFrame = ADEumInstrumentation.startSessionFrame("Checkout") } @IBAction func confirmOrderButtonClicked(_ sender: UIButton) { // Once users have confirmed payment info and shipping information, and they // are clicking the "Confirm" button to start the backend process of checking out, // we may know more information about the order itself, such as an order ID. let newSessionName = "Checkout: Order ID \(orderId)" checkoutSessionFrame.updateName(newSessionName) } func processOrderCompleted() { // Once the order is processed, the user is done "checking out", so we end the session frame. checkoutSessionFrame.end() checkoutSessionFrame = nil } func checkoutCancelled() { // If they cancel or go back, you'll want to end the session frame also, or else it will be // left open and appear to have never ended. checkoutSessionFrame.end() checkoutSessionFrame = nil }