New in CUX: Mobile Analytics. Analyze real user behavior inside your app. Learn More

Control React Native collection and mask content

Control React Native collection and mask content

Browse topics

On this page

Decide when your React Native app can collect analytics and hide sensitive screen content before capture. Collection controls and screenshot controls serve different purposes.

Package covered: @cuxio/react-native-sdk 1.0.22.

Initialize in a waiting state

Use needConfirmToStart: true in your single SDK initialization. Resume collection after your app obtains the required consent. Do not initialize again when consent changes.

Control data collection

After your app obtains consent:

CUX.resumeCollectingData();

When consent is withdrawn:

CUX.stopCollectingData();

Do not use CUX.reset() as proof that user identity was cleared. Verify account-switch behavior with your integration.

Hide sensitive content

Wrap a sensitive region in CUXMask:

import { Text } from 'react-native';
import { CUXMask } from '@cuxio/react-native-sdk';

<CUXMask>
  <Text>{accountBalance}</Text>
</CUXMask>

accountBalance is your app's displayed value. Check the resulting screenshots on both Android and iOS, including reused components and changing layouts.

You can call CUX.pauseScreenshots() when entering a sensitive flow and CUX.resumeScreenshots() after leaving it. These controls are separate from collection and do not filter event/user-property values. Do not rely on compatibility getters such as isScreenshotsPaused() as runtime proof: the covered JavaScript implementation returns a fixed value.

Verify collection and masking

Use synthetic data on Android and iOS. Check behavior before consent, after consent and after withdrawal.

  1. Open the initial screen, push a nested screen and return with Back. Repeat with quick transitions and tab changes used by your app.
  2. Scroll, change layouts and remove and recreate a masked component. Check reused list components too.
  3. Inspect all available screenshots around these changes in the recorded CUX visit, including images during navigation. A correctly masked first or final image alone is not enough.
  4. Check that the sensitive test region stays hidden while masking is enabled and that a separate nonsensitive region remains visible.
  5. Using synthetic content only, temporarily disable the mask and check that the test region becomes visible. Reenable it and repeat the journey.

Review screen names, identifiers and event parameters separately. A visual mask does not remove those values. See Mobile masking and privacy for the shared checklist.

If sensitive content appears, stop collection for the affected test, correct the configuration and repeat the journey. Follow React Native troubleshooting if the mask still does not apply.