セッションフレームの開始と終了
ISessionFrame API を使用して、セッションアクティビティに表示されるセッションフレームを作成できます。セッションフレームは、セッション中にユーザが実行している内容のコンテキストを提供します。この API を使用すると、ユーザ画面の命名方法が向上し、ビジネスコンテキスト内のユーザフローを記録できます。
使用例
次に、ISessionFrame API を使用する一般的な使用例を示します。
- 1 つの画面で複数の関数を実行し、個々の関数をより詳細に追跡する必要があります。
- ユーザフローは、複数の画面またはユーザのインタラクションに及びます。たとえば、API を使用してセッションフレーム「Login」、「Product Selection」、および「Purchase」を作成して、ユーザが購入のためにフローを記録することができます。
- ユーザの操作に基づいて動的情報をキャプチャし、オーダー ID などのセッションフレームに名前を付けることができます。
ISessionFrame API
次の表に、セッションフレームで使用できる 2 つのメソッドと 1 つのプロパティを示します。つまり、StartSessionFrame を使用してセッションフレームを開始してから、返された ISessionFrame オブジェクトを使用してセッションフレームの名前を変更し、終了します。
| クラス | メソッド/プロパティ | 説明 |
|---|---|---|
機器 |
方式:
|
セッションフレームに命名すると、セッションダイアログ内のフレームを簡単に特定して追跡できます。 |
ISessionFrame |
プロパティ:
|
セッションフレーム名を変更します。 |
ISessionFrame |
方式:
|
セッションフレームを終了します。 |
セッションフレームの例
次の例では、ISessionFrame API を使用し、チェックアウトプロセス中のユーザーアクティビティを追跡します。
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();
}
}
}