Amplitude Session Replay for React Native
npm install @amplitude/session-replay-react-nativeAmplitude Session Replay for React Native
``sh`
npm install @amplitude/session-replay-react-native
Initialize SDK with your amplidude API Key
`js
import { init, SessionReplayConfig } from '@amplitude/session-replay-react-native';
const config: SessionReplayConfig = {
apiKey: 'YOUR_API_KEY',
deviceId: 'YOUR_DEVICE_ID',
sessionId: Date.now()
}
await init(config);
`
Add the session replay plugin to your Amplitude instance as follows
`js
import { SessionReplayPlugin, SessionReplaPluginConfig } from '@amplitude/session-replay-react-native';
// ...
const config: SessionReplaPluginConfig = {
enableRemoteConfig: true, // default true
sampleRate: 1, // default 0
logLevel: LogLevel.Warn, // default LogLevel.Warn
};
await init('YOUR_API_KEY').promise;
await add(new SessionReplayPlugin(config)).promise;
`
To maks certain views, add the AmpMaskView tag with the mask property amp-mask around the section to be masked
`js
import { AmpMaskView } from '@amplitude/session-replay-react-native';
// ...
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}
>
{title}
`
To unmask views, add the AmpMaskView tag with the mask property amp-unmask around the section to be unmasked
`js
import { AmpMaskView } from '@amplitude/session-replay-react-native';
// ...
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}
>
{title}
`
Web views are blocked by default and will not be tracked. If you'd like webviews to be tracked, you can manually unmask
them by doing the following
`js``