セッションフレームの開始と終了

SessionFrame API を使用して、セッションアクティビティに表示されるセッションフレームを作成できます。セッションフレームは、セッション中にユーザが実行している内容のコンテキストを提供します。この API を使用すると、ユーザ画面の命名方法が向上し、ビジネスコンテキスト内のユーザフローを記録できます。

使用例

次に、SessionFrame API を使用する一般的な使用例を示します。

  • 1 つの では複数の関数が実行されていて、個々の関数をより詳細にトラッキングする必要があります。
  • ユーザフローは、複数の ViewController またはユーザの操作におよびます。たとえば、API を使用してセッションフレーム「Login」、「Product Selection」、および「Purchase」を作成して、ユーザが購入のためにフローを記録することができます。
  • ユーザの操作に基づいて動的情報をキャプチャし、オーダー ID などのセッションフレームに名前を付けることができます。

SessionFrame API

次の表に、セッションフレームで使用できる 3 つのメソッドを示します。つまり、 を使用してセッションフレームを開始してから、返された  オブジェクトを使用してセッションフレームの名前を変更し、終了します。
Objective-C
クラスメソッド説明
ADEumInstrumentation + (ADEumSessionFrame *)startSessionFrame:(NSString *)name

セッションフレームを開始して名前を付けるには、これを使用します。セッションフレームに名前を付けると、[Sessions Dialog] でフレームを簡単に識別して追跡できます。

ADEumSessionFrame - (void)updateName:(NSString *)name

セッションフレーム名の名前を変更します。startSessionFrame から返された ADEumSessionFrame オブジェクトからこのメソッドを呼び出します。

ADEumSessionFrame - (void)end

セッションフレームを終了します。startSessionFrame から返された ADEumSessionFrame オブジェクトからこのメソッドを呼び出します。

Swift
クラスメソッド説明
ADEumInstrumentation startSessionFrame(_ name: String?) -> ADEumSessionFrameセッションフレームを開始して名前を付けるには、これを使用します。セッションフレームに名前を付けると、[Sessions Dialog.] でフレームを簡単に識別して追跡できます。
ADEumSessionFrame
updateName(_ name: String?)セッションフレーム名の名前を変更します。startSessionFrame から返された ADEumSessionFrame オブジェクトからこのメソッドを呼び出します。
ADEumSessionFrame end()セッションフレームを終了します。startSessionFrame から返された ADEumSessionFrame オブジェクトからこのメソッドを呼び出します。

セッションフレームの例

次の例では、SessionFrame API を使用し、チェックアウトプロセス中のユーザーアクティビティを追跡します。
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
}