datadog_session_replay 1.0.0-preview.3
datadog_session_replay: ^1.0.0-preview.3 copied to clipboard
Support for Flutter Session Replay in Datadog
Datadog Session Replay #
⚠️ This package is currently in preview! Portions of the public API for this package may break without a major version update.
A package for integrating Datadog Session Replay into Flutter applications.
Getting started #
Session Replay for Flutter requires using the Datadog Flutter Plugin in conjunction with Datadog RUM. For more information on how to set up RUM, check the official documentation.
To use Datadog Session Replay for Flutter, first add the package to your pubspec.yaml
:
packages:
# other packages
datadog_flutter_plugin: ^x.x.x
datadog_session_replay: ^x.x.x
Next, add Session Replay to your DatadogConfiguration
:
import 'package:datadog_session_replay/datadog_session_replay.dart';
// ....
final configuration = DatadogConfiguration(
// Normal Datadog configuration
clientToken: 'client-token',
// RUM is required to use Datadog Session Replay
rumConfiguration: RumConfiguration(
applicationId: '<application-id'>
),
)..enableSessionReplay(
DatadogSessionReplayConfiguration(
// Setup default text, image, and touch privacy
textAndInputPrivacyLevel: TextAndInputPrivacyLevel.maskSensitiveInputs,
touchPrivacyLevel: TouchPrivacyLevel.show,
// Setup session replay sample rate.
replaySampleRate: 1.0,
),
);
Last, add a SessionReplayCapture widget to the root of your Widget tree, above your MaterialApp or similar application widget:
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
// Note a key is required for SessionReplayCapture
final captureKey = GlobalKey();
// Other App Configuration
@override
Widget build(BuildContext context) {
return SessionReplayCapture(
key: captureKey,
rum: DatadogSdk.instance.rum!,
sessionReplay: DatadogSessionReplay.instance!,
child: MaterialApp.router(color: color, routerConfig: router),
);
}
}
Note #
SessionReplayCapture
includes a RumUserActionDetector
. If you are already using a RumUserActionDetector
, you should remove it in favor of the one used by SessionReplayCapture
.
Documentation #
For more information including how to set up fine grained masking and privacy controls, see Datadog's official documentation for Session Replay.
Contributing #
Pull requests are welcome. First, open an issue to discuss what you would like to change. For more information, read the Contributing guide in the root repository.