Start and End Session Frames
You can use the ISessionFrame 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 ISessionFrame API:
- One screen performs multiple functions and you want more granular tracking of the individual functions.
- A user flow spans multiple screens 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.
ISessionFrame API
The table below lists the two methods and one property you can use with session frames. In short, you start a session frame with StartSessionFrame and then use the returned ISessionFrame object to rename and end the session frame.
| Class | Method/Property | Description |
|---|---|---|
Instrument |
Method:
CODE
|
Use this to start and name your session frame.Naming session frames enables you to easily identify and track the frames in the Sessions Details dialog. |
ISessionFrame |
Property:
CODE
|
Rename the session frame name.You assign the updated session frame name with this property from the |
ISessionFrame |
Method:
CODE
|
End the session frame.You call this method from the |
Session Frame Example
In the following example, the ISessionFrame API is used to track user activity during the checkout process.
using AppDynamics.Agent;
...
namespace ShoppingApp {
public partial class ShoppingCart : ContentPage {
private ISessionFrame sessionFrame;
private string orderId;
...
void checkoutCartButtonClicked(object sender, EventArgs e) {
// The checkout starts when the user clicks the checkout button.
// This may be after they have updated quantities of items in their cart, etc.
sessionFrame = Instrumentation.StartSessionFrame("Checkout");
}
void confirmOrderButtonClicked(object sender, EventArgs e) {
// 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.
sessionFrame.Name = $"Checkout: Order ID {this.orderId}";
}
void processOrderCompleted(object sender, EventArgs e) {
// Once the order is processed, the user is done "checking out" so we end
// the session frame.
sessionFrame.End();
}
void checkoutCancelled(object sender, EventArgs e) {
// 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.
sessionFrame.End();
}
}
}