Overview

Skill Level: Intermediate

You configure several items for your application, including how screen layouts are logged, Target page location, kill switch location, and whether gestures will be logged.

Prerequisites

Before you can implement Customer Experience Analytics for Mobile , you must install the Tealeaf SDK for iOS development in your app. For information, see Getting started with the IBM Tealeaf SDK for iOS using Swift or Getting started with the IBM Tealeaf SDK for iOS using Objective C.

Information to keep in mind while configuring your iOS SDK

TLFConfigurableItems.plist

Everything that you configure is in the TLFConfigurableItems.plist file. This file is in the Install Package in the Tealeaf/Resources/TLFResources.bundle file.

Auto-instrumentation

By default, the iOS SDK automatically instruments your application for a set of predefined events. You can disable auto-instrumentation and then apply custom instrumentation for elements in your application. Auto-instrumentation is set with the DisableAutoInstrumentation field. You should leave this setting as YES.

If you choose to use custom instrumentation, see Custom instrumentation for more information.

Step-by-step

  1. Configure IBM Tealeaf for your application

    All of the configuration in this task involves modifying settings in the TLFConfigurableItems.plist file in the IBM Tealeaf Resources folder that you added to your Xcode project.

    1. In your project in Xcode, open the TLFConfigurableItems.plist file.
    2. Set the GetImageDataOnScreenLayout to NO to log MD5 checksum and png or jpg images. This option creates smaller payloads in production and is the recommended setting.
      Note: You can set GetImageDataOnScreenLayout to YES to capture base 64 data.
    3. Set the PostMessageUrl to the URL of the Target page for your app.
      Note:
      All events that are captured are sent in JSON format to a Target page. The Target page acknowledges the receipt of the JSON message and forwards the client-side events to IBM Tealeaf.
    4. Set the KillSwitchUrl to the URL for the kill switch for your app.
      Note:
      The Kill Switch is used to control logging. When the kill switch is enabled, it must have a URL to check before the framework initializes. When the page is reachable, the framework initializes. If the page is not reachable, because of network problems or because you disabled it on your server, the framework does not initialize.
    5. Save and exit the TLFConfigurableItems.plist file.
  2. Configure gesture capture.

    To configure gestures for your application:

    1. Modify the TLFConfigurableItems.plist file and set the SetGestureDetector field to YES to log gestures.
    2. If you are using your own gestures, modify the delegate for your Gesture Recognizer to work with Tealeaf Capture. See these steps below.
      Note: You only need to do this if you are using your own gestures in your application. If you are using the Tealeaf gestures, you do not need to do this.

    Log Gestures

    You can capture gestures that the user makes on your application. Gesture capture is set with the SetGestureDetector field. Gestures are logged as Type 11 JSON messages.

    Unresponsive gesture events captured

    Unresponsive gestures are gestures that do not respond when a user tries to select items in an application or tries to adjust views in the application. Like other gesture events, unresponsive gestures are captured by Tealeaf.

    Unresponsive gestures are displayed graphically in BBR as orange outlined icons accompanied by a circled “X” . The circled “X” denotes that the gesture was unresponsive. For example, if a double tap gesture did not yield a response in the mobile application, then at replay time that gesture is displayed with the following icon in BBR:

    Screen capture of the image that displays for unresponsive gestures

    Note: The arrows that illustrate the direction of a swipe or pinch gesture are not supported by the Internet Explorer browser.

     
    Tap gestures
    Gesture name Description Image displayed in Replay Unresponsive gesture image in Replay
    Tap

    This gesture is a one-finger gesture.

    For a tap gesture, one-finger taps and lifts from the screen in 1 location.

     Screen capture of the single tap gesture image that displays in Replay  Screen capture of the image that displays for the unresponsive tap gesture
    Tap and Hold

    This gesture is a one-finger gesture.

    For a Tap and Hold gesture, one-finger presses and stays on the screen until information is displayed or an action occurs.

    Note: The response to a Tap and Hold gesture can vary from one application to another. For example, a Tap and Hold gesture might display an information bubble, magnify content under the finger, or present the user with a context menu.

     Screen capture of the tap and hold gesture image that displays in Replay  Screen capture of the image that displays for the unresponsive double tap gesture
    Double tap

    This gesture is a one-finger gesture.

    For a double tap gesture, one-finger taps twice in close succession in 1 location of the screen.

     Screen capture of the double tap gesture image that displays in Replay Screen capture of the image that displays for the unresponsive tap and hold gesture 
    Swipe gestures
    Gesture name Description Image displayed in Replay Unresponsive gesture image in Replay
    Swipe vertically

    This gesture is a one-finger gesture.

    For a swipe vertically gesture, one-finger:

    1. Taps and holds in 1 location of screen,
    2. Continues to engage screen while it moves up or down
    3. Lifts from the screen in different location.

    Screen capture of the swipe vertically gesture image that displays in Replay

    Note: The initial tap becomes lighter in color, while the destination is highlighted by a darker color


    Screen capture of the unsupported swipe vertically gesture image that displays in Replay

    Note: Accompanying arrows indicate the direction of the swipe

    Swipe horizontally

    This gesture is a one-finger gesture.

    For a swipe horizontally gesture, one-finger:

    1. Taps and holds in 1 location of screen,
    2. Continues to engage screen while it moves left or right
    3. Lifts from the screen in different location.

    Screen capture of the swipe horizontally gesture image that displays in Replay

    Note: The initial tap becomes lighter in color, while the destination is highlighted by a darker color

    Screen capture of the swipe horizontally gesture image that displays in Replay

    Note: Accompanying arrows indicate the direction of the swipe

     

    Resize gestures
    Gesture name Description Image displayed in Replay Unresponsive gesture image in Replay
    Pinch open

    Sometimes referred to as a spread gesture, this is a two-finger gesture.

    For a pinch open gesture, 2 fingers:

    1. Tap and hold in 1 location of the screen,
    2. Maintain contact with the screen while the fingers move apart from each other in any direction,
    3. Lift from the screen at a new location.

    Screen capture of the pinch gesture image that displays in Replay

    Note:

    Accompanying arrows indicate the direction (open or close) of the pinch

    Screen capture of the unsupported pinch open gesture image that displays in Replay

    Note: Accompanying arrows indicate the direction of the pinch

    Pinch close

    This gesture is a two-finger gesture.

    For a pinch close resize gesture, 2 fingers:

    1. Tap and hold in 1 location on the screen,
    2. Maintain contact with the screen while the fingers move toward each other,
    3. Lift from the screen at a new location.

    Screen capture of the pinch gesture image that displays in Replay

    Note: Accompanying arrows indicate the direction (open or close) of the pinch

    Screen capture of the unsupported pinch close gesture image that displays in Replay

    Note: Accompanying arrows indicate the direction of the pinch

    Modifying the delegate for your Gesture Recognizer to work with Tealeaf capture

    If you have your own gestures recognizer in your application, the code might affect the Tealeaf gesture capture feature. To ensure that your gestures and Tealeaf capture work together, you add a method to the delegate for your Gesture Recognizer.

    Note: You do this task only if you are using your own gesture recognizer.

    1. Locate the delegate for your Gesture Recognizer.
    2. Add this method to the delegate:
      - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
      {
      return YES;
      }
  3. Enable geolocation capture.

    You modify the TLFConfigurableItems.plist file to enable geolocation capture for your application.

    All of the configuration in this task involves modifying settings in the TLFConfigurableItems.plist file in the Tealeaf Resources folder that you added to your Xcode project.

    It is up to you to prompt the user for permissions to collect geolocation information for your application according to Apple guidelines.

    1. In your project in Xcode, open the TLFConfigurableItems.plist file.
    2. Set the LogLocationEnabled field to YES to log gestures.
    3. Save and exit the TLFConfigurableItems.plist file.
    4. Edit the info.plist file that is used with your project and the following geolocation keys:
      Key Value (String)
      NSLocationAlwaysUsageDescription

      Enter a description that explains why you want the user to allow the application to access the user location information.

      NSLocationWhenInUseUsageDescription

      Enter a description that explains why you want the user to allow the application to access the user location information.

      Chrome browser is deprecating the support for API getCurrentPosition() and watchPosition() on insecure origins (http url). To capture geolocation data, you must use secure origins.
      By adding the geolocation keys, iOS prompts the user to allow geolcation tracking within the application.

    5. Save and exit the info.plist file.

    Note: The UI Capture library typically tracks geolocation information within the Web application. When geolocation is enabled in a hybrid mobile application, the geolocation tracking feature in the Web application should be disabled and the application should use the native SDK capture the geolocation information.

    To disable geolocation capture in the Web application:

    1. Locate the UI Capture library configuration. The configuration is typically at the end of the UI Capture SDK file as part of the call to the TLT.init() API.
    2. Locate the geolocation configuration section in the replay module configuration object (modules.replay.geolocation).
    3. If the geolocation configuration section does not exist, the feature is disabled automatically. If the section does exist, then ensure that the enabled setting is set to false. The following example shows the geolocation section for the UI Capture SDK with geolocation disabled.
      geolocation: {
      enabled: false,
      triggers: [
      {
      event: "load"
      }
      ] },
    4. Remove the NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription geolocation keys from the info.plist file that is associated with your project.

     

  4. Enable type 10 screen logging for native mobile applications by using the AutoLayout controller.

    Screen logging for a native mobile application can be enabled by configuring the AutoLayout controller instead of adding custom code to enable screen logging in your application.

    The Tealeaf iOS SDK can use the settings that are defined in TealeafLayoutConfig.json to log type 10 screen layouts for screenviews of native mobile application sessions. The AutoLayout controller also enables the application to automatically continue logging type 10 screen layouts when it resumes to the foreground. You can replay a mobile app session in cxImpact Browser Based Replay as you would an HTML web session instead of viewing the mobile app session as a series of screen captures. TealeafLayoutConfig.json is packaged with TLFResources.bundle and is formatted as a JSON file.

    Edit TealeafLayoutConfig.json to configure Autolayout to log screen layouts.

    Table 1: AutoLayout sub entries

    Sub entry Description
    ScreenChange

    This entry is replacing do in Tealeaf SDK 10.4.1 (and later).

     

    Boolean value

    Indicates if the screen should be tracked or not.

    • true¬†(Capture Type 2s for this screen): Tracks the screen.
    • false (Don’t Capture Type 2s for this screen): Does not track the screen.

     

    Example: To enable tracking for the screen: 

    "ScreenChange": true
    DisplayName

    This entry is replacing screenViewName in Tealeaf SDK 10.4.1 (and later).

     

    String value

    Provides the name of the screen to be shown during replay, instead of showing the view controller name or activity name. DisplayName is displayed during replay in the navigation list. If DisplayName is empty, view controller class name is used.

    For example, the DisplayName for a payments page might be “Payment Screen”.

    Example: To set the value of DisplayName to Payment Screen: 

    "DisplayName": "Payment Screen" 

     

    CaptureLayoutDelay

    This entry is replacing delay in Tealeaf SDK 10.4.1 (and later).

     

    Numeric value

    The delay in milliseconds before Tealeaf SDK takes a layout capture of a screen. Increasing the value of this setting increases the amount of time that must pass between when the layout is loaded and when the layout logging action occurs. The CaptureLayoutDelay value is used for ScreenChange and ScreenShot.

    Example: To set the delay between layout load and layout logging to 500 milliseconds:

    "CaptureLayoutDelay": 500
    CaptureScreenshotDelay

    Numeric value

    The number of milliseconds to wait before capturing screenshot.  Increasing the value of this setting increases the amount of time that must pass between when the screen is loaded and when the screen logging action occurs. The CaptureScreenshotDelay value is used for ScreenChange and ScreenShot.

    Example: To set the delay between screen load and screen logging to 500 milliseconds:

    "CaptureScreenshotDelay": 500
    ScreenShot

    This entry is replacing takeScreenShot in Tealeaf SDK 10.4.1 (and later). Note that takeScreenShot applied only for type 2 load events but ScreenShot applies to type 2, 4, 10, 11.

     

    Boolean value

    Indicates whether or not to capture screenshots on this screen.

    • true (Capture screenshots on type 2, 4, 10, 11): Takes a screen capture.
    • false (Don’t capture screenshots on this screen): Does not take a screen capture. If you do not want Tealeaf SDK to take any screenshots on a specific screen, set ScreenShot to false.

    Example: To turn on screen capturing for the screen activity:

    "ScreenShot": true
    CaptureUserEvents

    This entry is replacing CaptureScreenContents in Tealeaf SDK 10.4.1 (and later).

    Boolean value

    Indicates whether or not to track user events like type 4s or 11s.

    • true (Capture type 4, 11): Tealeaf SDK resumes capturing user events (type 4, 11) on the specified screen.
    • false (Don’t capture type 4, 11): Tealeaf SDK pauses, does not capture type 4, 11 events, and based on the value of CaptureScreenVisits, captures screen load/unload events.

    Example:  To turn on user event capturing for the screen activity: 

    "CaptureUserEvents": true
    CaptureLayoutOn

    Numeric value

    The event to capture layout on. Never, or on first user gesture, or on screen change.

    • 2 (Capture Layout on screen change): Tealeaf SDK captures the layout as soon as the view controller is loaded.
    • 1 (Capture Layout on first user gesture): Tealeaf SDK captures the layout after the end user makes a first gesture on a given view controller.
    • 0 (Don’t Capture Layout): the layout is not captured.

    Example:  To capture layout on screen changes: 

    "CaptureLayoutOn": 2
    CaptureScreenshotOn

    Numeric value

    The event to capture screenshots for view controller load events: Never, or on first user gesture, or on screen changes. 

    • 2¬†(Capture screen load screenshot on screen change): Captures screen load screenshot on screen changes.¬† Tealeaf SDK captures the screenshot as soon as the view controller is loaded.
    • 1 (Capture screen load screenshot on first user gesture): Tealeaf SDK captures the screenshot after the end user makes a first gesture on a specified view controller.
    • 0 (Don’t capture screen load screenshot): Does not take a screen capture. Note that even if CaptureScreenshotOn is set to 0 and ScreenShot is true, the Tealeaf SDK continues to capture screenshots on other user events, such as type 4 and type 11. CaptureScreenshotOn applies only to screenshots on view controller load.

    Example: To capture screen load screenshot on screen changes: 

    "CaptureScreenshotOn": 2
    CaptureWebViewScreenshotOn

    Numeric value

    The event to capture the first screenshot on for a web view, if there is any.

    • 2 (Capture webview screen load screenshot on screen change): Captures the webview screen load screenshot on screen changes.¬†
    • 1 (Capture webview screen load screenshot on first user gesture): Captures the webview screen load screenshot on the first user gesture.¬†
    • 0 (Don’t capture webview screen load screenshot): Does not capture the webview screen load screenshot.¬†

    Example: To capture webview screen load screenshot on screen changes: 

    "CaptureWebViewScreenshotOn": 2

     

    NumberOfWebViews

    This entry is replacing numberOfWebviews and isWebView in Tealeaf SDK 10.4.1 (and later). If you set isWebView = false in earlier releases, you can now set NumberOfWebViews = 0. Non-zero values for NumberOfWebViews indicate the number of web views on a view controller.

     

    Numeric value

    Indicates the amount of webviews on the page. Default value is 0.

    CaptureScreenVisits

    Boolean value

    Indicates whether you want type 2 objects on pages that you set CaptureUserEvents to false. This property helps you understand how your users are using your application by showing how they get to a page. Default value is true.

    If you do not want to track screen load/unload events, set this entry to false. CaptureScreenVisits applies only if CaptureUserEvents = false. If CaptureUserEvents = true, CaptureScreenVisits is ignored and load/unload events are tracked because it doesn’t make any sense to track user events on a screen where visits are not tracked.

    AppendMapIds

    JSON

    Assigns an identifier to a target item. You can assign a readable identifier to the mid that maps to the target item. You can then configure events to fire when the identifier is encountered. You can use the same identifier for Android devices as well as iOS devices. When you assign the same identifier to your Android and iOS devices, you can create a single event in Event Manager that fires on the identifier. The event fires for both Android and iOS devices.

    Example:

      "AppendMapIds": {
     "[PWDV,0][ABOL,0][FL,0][TH,0][LL,0][TW,0][LL,1][LL,0]": {
       "mid": "LoginButton"
       },
     "ibm.com.demoapp.main_activity_login:id\/send": {
       "mid": "LoginButton"
       }
    
    
    

    Uses the mid setting to assign an identifier to two targets. The first target is for an iOS device and the second target is for an Android device. The target for both devices is identified as LoginButton. You can create a single event that fires when LoginButton is encountered in either application.

    The following snippet shows an example of the TealeafLayoutConfig.json file.

     

    {
      "AutoLayout": {
          "IBMGlobalScreenSettings":{
              "ScreenChange": true,
              "DisplayName": "",
              "CaptureLayoutDelay": 0,
              "ScreenShot": false,
              "NumberOfWebViews": 0,
              "CaptureUserEvents": true,
              "CaptureScreenVisits": true,
              "CaptureLayoutOn": 2,
              "CaptureScreenshotOn": 0
          },
          "PaymentViewController":{
              "ScreenChange": false,
              "DisplayName": "The Payment Screen",
              "CaptureLayoutDelay": 0,
              "ScreenShot": false,
              "NumberOfWebViews": 0,
              "CaptureUserEvents": false,
              "CaptureScreenVisits": true,
              "CaptureLayoutOn": 0,
              "CaptureScreenshotOn": 0
          }
      },
      "AppendMapIds": {
          "[w,9290],[v,0]": {
              "mid": "ASimpleUIView"
          },
          "tag2999999": {
              "mid": "giveAdditionalId1"
          },
          "idxPathValue": {
              "mid": "giveAdditionalId2"
          }
      }
    }
    
    
    

    Capture specific pages by pausing and resuming the library

    There are two ways of pausing and resuming the library:

    • Edit¬†TealeafLayoutConfig.json. This is the preferred method.
    • Call TealeafLayoutConfig.json.

    Edit TealeafLayoutConfig.json

    By default, if you are missing the IBMGlobalScreenSettings section, you have the following defaults, which capture all pages, events, and gestures, but no screenshots:

     

    "AutoLayout": {
    "IBMGlobalScreenSettings":{
              "ScreenChange": true,
              "DisplayName": "",
              "CaptureLayoutDelay": 0,
              "ScreenShot": false,
              "NumberOfWebViews": 0,
              "CaptureUserEvents": true,
              "CaptureScreenVisits": true,
              "CaptureLayoutOn": 2,
              "CaptureScreenshotOn": 0
          },
    },
    "AppendMapIds": {
      }
    
    /

    You use CaptureUserEvents to indicate that you want to pause the library and no longer capture information on a page. To pause the library, set CaptureUserEvents to false. To resume the library, set CaptureUserEvents to true. Remember that pausing the library pauses only capture of user events. If you do not want to capture screens at all, set ScreenChange to false. If you do not want to capture screen visits, set CaptureScreenVisits to false.

    For example, to capture all data except for user events on “FirstViewController”, which is the first page, enable the library to resume on “SecondViewController”, which is the second page.

    {
       "AutoLayout": {
    "IBMGlobalScreenSettings":{
            "ScreenChange": true,
             "DisplayName": "",
             "CaptureLayoutDelay": 0,
             "ScreenShot": false,
             "NumberOfWebViews": 0,
             "CaptureUserEvents": true,
             "CaptureScreenVisits": true,
             "CaptureLayoutOn": 2,
             "CaptureScreenshotOn": 0
           },
           "FirstViewController": {
            "ScreenChange": false,
             "DisplayName": "First Screen",
             "CaptureLayoutDelay": 0,
             "ScreenShot": false,
             "NumberOfWebViews": 0,
             "CaptureUserEvents": false,
             "CaptureScreenVisits": false,
             "CaptureLayoutOn": 0,
             "CaptureScreenshotOn": 0
           },
           "SecondViewController": {
            "ScreenChange": true,
             "DisplayName": "Second Screen",
             "CaptureLayoutDelay": 0,
             "ScreenShot": false,
             "NumberOfWebViews": 0,
             "CaptureUserEvents": true,
             "CaptureScreenVisits": true,
             "CaptureLayoutOn": 2,
             "CaptureScreenshotOn": 0
           }
       },
       "AppendMapIds": {
       }
    }
    
    
    

    Additionally, you can disable capture of all data except for specific pages, as shown in the following example.

    {
      "AutoLayout": {
    "IBMGlobalScreenSettings":{
           "ScreenChange": false,
            "DisplayName": "",
            "CaptureLayoutDelay": 0,
            "ScreenShot": false,
            "NumberOfWebViews": 0,
            "CaptureUserEvents": false,
            "CaptureScreenVisits": false,
            "CaptureLayoutOn": 0,
            "CaptureScreenshotOn": 0
          },
          "FirstViewController": {
           "ScreenChange": true,
            "DisplayName": "First Screen",
            "CaptureLayoutDelay": 0,
            "ScreenShot": false,
            "NumberOfWebViews": 0,
            "CaptureUserEvents": true,
            "CaptureScreenVisits": true,
            "CaptureLayoutOn": 2,
            "CaptureScreenshotOn": 0
          },
          "SecondViewController": {
           "ScreenChange": true,
            "DisplayName": "Second Screen",
            "CaptureLayoutDelay": 0,
            "ScreenShot": false,
            "NumberOfWebViews": 0,
            "CaptureUserEvents": true,
            "CaptureScreenVisits": true,
            "CaptureLayoutOn": 2,
            "CaptureScreenshotOn": 0
          }
      },
      "AppendMapIds": {
      }
    }
    
    
    

    For more information about configuring properties in TealeafLayoutConfig.json for pausing and resuming the library, see Table 1. 

    Call TealeafLayoutConfig.json programmatically

    Use IBMGlobalScreenSettings to set values for all view controllers in TealeafLayoutConfig.json that are not documented.

    If you want to call TealeafLayoutConfig.json programmatically, go to the page where you want to start pausing the library on viewWillAppear. viewWillAppear is always called when view controller is displayed.

    Note: viewDidLoad is called only the first time it is created.

     

    -(void)viewWillAppear:(BOOL)animated {
    [[TLFApplicationHelper sharedInstance] pauseTealeaf];
    [super viewWillAppear:animated];
    }
    

    Next, go to the page where you want to start resuming the library on viewWillAppear. 

    -(void)viewWillAppear:(BOOL)animated {
    [[TLFApplicationHelper sharedInstance] resumeTealeaf];
    [super viewWillAppear:animated];
    }
    
    
    

     

     

  5. Configure exception logging.

    Exceptions are the way that a system or framework communicates to the application that something has gone wrong and not to continue with the execution of the program unless the exception is one of the expected ones. You can manually and automatically log caught exceptions using the Tealeaf SDKs so that the exception information can be used for analytics.

    Three ways to log exceptions

    In iOS SDK there are three ways to log exceptions that are trapped by your application exception handler. These methods do not use the Cocoa SDK, which is not exception- safe. This table lists the methods used to log exceptions and the parameters used in each method:

    Method Parameters
    - (BOOL)logNSExceptionEvent:(NSException *)exception;
    Where:

    • @param exception – The caught NSException instance.
    • @return if the event was successfully logged or not.
    - (BOOL)logNSExceptionEvent:(NSException *)exception dataDictionary:(NSDictionary*)dataDictionary;

    You set the NSSetUncaughtExceptionHandler of your AppDelegate.m inside of: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

    Where:

    • @param exception – The caught NSException instance.
    • @param dataDictionary – Additional data about the exception.
    • @return if the event was successfully logged or not.
    - (BOOL)logNSExceptionEvent:(NSException *)exception dataDictionary:(NSDictionary*)dataDictionary isUnhandled:(BOOL)unhandled;
    Where:

    • @param exception – The caught NSException instance.
    • @param dataDictionary – Additional data about the exception.
    • @param unhandled – Indicates whether the exception was caught by an exception handler or not.
    • @return if the event was successfully logged or not.

    Example

    In this example, you have a method that causes an exception:

    -(void)aMethod {
    [self causesAnException];
    }

    You add an @try , @catch, and the [[TLFCustomEvent sharedInstance] logNSExceptionEvent:exception]; method to handle the exception:

    -(void)aMethod {
    @try {
    [self causesAnException];
    }
    @catch(NSException *exception) {
    [[TLFCustomEvent sharedInstance] logNSExceptionEvent:exception];
    }
    }

    Log uncaught exceptions

    You can log uncaught exceptions by setting up and adding an NSUncaughtExceptionHandler.

    Logging exceptions

    Use the examples in this task as a guide to adding exception logging to your application. You might want to use the top-level NSSetUncaughtExceptionHandler(&SampleAutoUncaughtExceptionHandler); to identify bugs in your application.

    The current iOS SDK catches some exceptions and prevents them from being logged to the target page. In some cases this may prevent an application from catching the exception.

    1. Determine the method for which you want to log exceptions. For example, you have a method:
      -(void)aMethod {
      [self causesAnException];
      }
    2. Optional: Add the exception method that you want to use to the method for which you want to

      Add @try , @catch, and the [[TLFCustomEvent sharedInstance] logNSExceptionEvent:exception]; method to handle the exception:

      -(void)aMethod {
      @try {
      [self causesAnException];
      }
      @catch(NSException *exception) {
      [[TLFCustomEvent sharedInstance] logNSExceptionEvent:exception];
      }
      }
    3. Optional: Set up an NSUncaughtExceptionHandler for logging for uncaught exceptions:

      The application library needs the application to set NSUncaughtExceptionHandler. The application library saves the reference to the application’s NSUncaughtExceptionHandler; then, sets its own NSUncaughtExceptionHandler, which is called after the application library reporting exception.

      For example:

      void MyAppsUncaughtExceptionHandler(NSException *exception)
      {
      NSLog(@"My Application Uncaught Exception Handler");
      }
      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      // Override point for customization after application launch.

      NSSetUncaughtExceptionHandler(&MyAppsUncaughtExceptionHandler);
      [[TLFApplicationHelper sharedInstance] enableTealeafFramework];

      return YES;
      }
  6. Instrument IBM Tealeaf SDKs with a Cordova mobile application

    More configuration is needed to instrument the Tealeaf iOS SDK with mobile applications that are created using Cordova.

    Logging can experience issues due to delays with screen loading in Cordova-based applications. The TealeafAdvancedConfig.json configuration file contains the property IsCordovaApp and CordovaLayoutDelay, which delays logging for Cordova-based applications when it is enabled. IsCordovaApp is a Boolean property and can be set to true or false. The amount of time for the delay is stored in the CordovaLayoutDelay property. CordovaLayoutDelay is a numeric property and is configured for milliseconds.

    TealeafAdvancedConfig.json is included with TLFResources.bundle in the assets folder.

    The following table describes the Tealeaf SDK instrumentation properties that must be configured to log user interaction with a mobile application that is created in Cordova.

    Instrumentation property Description
    IsCordovaApp

    To enable the logging delay for a Cordova application, edit TealeafAdvancedConfig.json and set IsCordovaApp to true.

    Example: ‚ÄúIsCordovaApp‚ÄĚ: true

    To disable the logging delay for a Cordova application, edit TealeafAdvancedConfig.json and set IsCordovaApp to false. By default, IsCordovaApp is disabled.

    Example: ‚ÄúIsCordovaApp‚ÄĚ: false

    CordovaLayoutDelay

    When IsCordovaApp is enabled, you also need to set the logging delay by assigning a numeric value, in milliseconds, to CordovaLayoutDelay. The value is used to define the amount of time that must pass between when the screen loads and when Tealeaf begins logging user interaction with the screen.

    Example: ‚ÄúCordovaLayoutDelay‚ÄĚ: 750 sets the logging delay to 750 ms.

    In addition to configuring the properties in TealeafAdvancedConfig.json, include the following project files to your Cordova application:

    • Tealeaf/CordovaDependencies/NSObject+TealeafEarlyLoads.h
    • Tealeaf/CordovaDependencies/NSObject+TealeafEarlyLoads.m

    NSObject+TealeafEarlyLoads.h and NSObject+TealeafEarlyLoads.m are used to initialize the iOS SDK when the Cordova application loads.

Expected outcome

Your Tealeaf SDK is implemented for iOS development in your app.

Next, follow this tutorial to configure DOM capture. If you have a Native iOS applications that cannot use Passive Capture Application, use this tutorial.

Join The Discussion

Your email address will not be published. Required fields are marked *