React Native SDK: Advanced Options

Singular React Native SDK 
Singular React Native SDK version 3.1.7(see Change Log)
Compatibility  React Native 0.46.4+
Integration Guides
  1. Basic Integration
  2. Tracking Events and Revenue
  3. Implementing Deep Links
  4. Adding SKAdNetwork Support
  5. Advanced Options


Tracking Uninstalls

To let Singular track uninstalls for your app:

  1. First, configure the app in the Singular platform, as detailed in Setting Up Uninstall Tracking.
  2. Use your preferred method to retrieve the APNS/FCM tokens in React Native.
  3. Call the setUninstallToken method, passing the APNS/FCM token to as in the example below. Be sure to pass the right token based on the device platform.
Singular.setUninstallToken Method
Description Send Singular the APNS/FCM token in order to let it track app uninstalls.
Usage Example
if (Platform.OS === 'ios') {
} else if (Platform.OS === 'android'){

Modifying the Session Timeout

The Singular SDK manages user sessions automatically, so you don't need to add any code to handle sessions. However, you can modify the session timeout value if you want.

By default, if the app runs in the background for 60 seconds or more before returning to the foreground, the SDK registers a new session.

To change the timeout value, use .withSessionTimeoutInSec when you create the SingularConfig object. For example:

const config = new SingularConfig('<API_KEY>', '<SECRET>')
    .withSessionTimeoutInSec(120); // Set timeout to 120 seconds

Complying with Data Privacy Laws

Singular provides privacy-safeguarding functionality to help you cooperate with any partners who may be complying with consumer privacy laws such as GDPR and CCPA (California Consumer Privacy Act). These partners want to be notified if the end-user has consented to share their private information.

If you have implemented a way to ask users for consent to share their information, use the limitDataSharing method to notify Singular of the user's choice:

  • Use Singular.limitDataSharing(false) to indicate that the user consented (opted in) to share their information.
  • Use Singular.limitDataSharing(true) if the user did not consent.

Singular will pass this information on to partners who require it in order to comply with relevant regulations.

Note: The use of the method is optional, but there may be attribution information that the partner will share with Singular only if specifically notified that the user has opted in.

Singular.limitDataSharing Method
Signature Singular.limitDataSharing(shouldLimitDataSharing)
Description Notify Singular of user consent (opt-in) for sharing private data.
Usage Example
// User has opted into sharing data

Additional Methods for GDPR Compliance

The Singular SDK provides several methods to help you comply with GDPR policies and let Singular know about user consent or non-consent for tracking.

Singular.trackingOptIn Method
Description Let Singular know of user consent (opt-in) for tracking.
Usage Example
Singular.stopAllTracking Method

Stop all tracking activities for this user on this app.

Important: This effectively disables the Singular SDK, even after you restart the app. The only way to re-enable the SDK is by calling resumeAllTracking.

Usage Example
Singular.resumeAllTracking Method
Description Resume tracking activities for this user on this app.
Usage Example
Singular.isAllTrackingStopped Method
Description Check the tracking status for this user on this app. Returns true if tracking has been stopped.
Usage Example


Was this article helpful?