Enable Session Replay on crashes

This page describes how to enable and customize Session Replay on crashes for your iOS apps.

Session Replay on crashes gives you additional context for crash analysis in the form of video-like screen recordings that replay all the user actions immediately preceding a detected crash.


Ensure that your system meets the following requirements:

  • Dynatrace version 1.208+
  • OneAgent version 1.207+
  • An active Dynatrace Digital Experience Monitoring license
  • Dynatrace Managed deployments only: A secondary disk configured to store user session data

Enable Session Replay on crashes

Do the following to enable Session Replay on crashes.

1. Enable Session Replay for mobile

This setting ensures that the Session Replay SDK is included in the Podfile that needs to be integrated into your application.

  1. In the Dynatrace menu, go to Mobile.
  2. Select the application you want to configure.
  3. Select Browse () > Edit.
  4. Select General from the Mobile app settings menu.
  5. Turn on Enable Session Replay.

2. Enable Session Replay on crashes.

This setting ensures that sessions with crashes are recorded.

  1. Select Instrumentation settings from the Mobile app settings menu.
  2. Turn on Include Session Replay on crashes.

3. Add Session Replay as dependency within Podfile specification

This step ensures that Session Replay is added as a dependency within your Podfile specification.

  1. Select Instrumentation wizard from the Mobile app settings menu.
  2. Select iOS.
  3. Copy the string from the Modify your Podfile step and add it to your Podfile. For example:
    pod 'Dynatrace/SessionReplay', '~> 8.207'

Crash analysis

After you enable Session Replay on crashes, you can start crash analysis from your mobile application overview page.

  1. In the Dynatrace menu, go to Mobile.
  2. Search for your mobile application, and select it to access the application overview page.
  3. In the infographic, select the Crashes tile. You'll see the graph showing the total number of crashes by version during the selected timeframe.
  4. Select Analyze crashes.
  5. All crashes caused by the same exception are organized into a Crash group. The Crash analysis page lets you filter the crash groups by the application version. In the Crash groups list, select a crash group you're interested in.
  6. In the crash group details page, you can use the Next / previous crash occurrence arrows to browse through all the crash occurrences. Select the crash occurrence you're interested in, and select the Session information tab to replay what happened on the user's screen immediately before your application crashed.

Mask sensitive data

Session Replay for mobile comes with the three predefined masking levels:

  • Safest
    All the editable texts fields, images, labels, web views, and switches are masked.
  • Safe
    All the editable texts fields are masked.
  • Custom
    Masks the same as Safest by default, but you can decide exactly which app components or views should be masked.

Change masking level

By default, OneAgent applies the Safest masking level. To change it to the Safe or Custom level, use the API to configure OneAgent.

  1. Import the DynatraceSessionReplay framework to the class.
import DynatraceSessionReplay
  1. Set the level
let maskingConfiguration = MaskingConfiguration(maskingLevelType: .safe) // .safest or .custom

Custom masking

If you set the level to Custom, you can use additional API methods to decide exactly which app components or views should be masked.

Masking rules

You can enable or disable rules globally or for selected components, such as texts fields, images, labels, web views, and switches.

try? maskingConfiguration.add(rule: .maskAllImages)         // Adds one rule
try? maskingConfiguration.remove(rule: .maskAllSwitches)    // Removes one rule
try? maskingConfiguration.addAllRules()                     // Adds all rules
try? maskingConfiguration.removeAllRules()                  // Removes all rules

If you remove all masking rules, Session Replay won't mask anything. If you enable all masking rules, it's equivalent to the safest masking level.

Mask views

You can also enable or disable masking of the selected views based on their accessibility identifier.

try? maskingConfiguration.addMaskedView(viewIds: ["masked_view_id"])
try? maskingConfiguration.removeMaskedView(viewIds: ["masked_view_id"])
try? maskingConfiguration.addNonMaskedView(viewIds: ["nonMasked_view_id"])
try? maskingConfiguration.removeNonMaskedView(viewIds: ["nonMasked_view_id"])