> For the complete documentation index, see [llms.txt](https://doc.batch.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.batch.com/developer/sdk/react-native/data-privacy/opt-out.md). Agents can also search and read this documentation through its [MCP server](https://doc.batch.com/~gitbook/mcp).

# SDK opt-out (e.g. GDPR)

If you plan to send personal user data and have to comply with EU's GDPR, any other data privacy law or simply want to give your users more control regarding their privacy, these methods will help you plug your consent screen to Batch.

There are two SDK operation modes:

* **SDK enabled by default**, opting-out required via an explicit method call: this is the default mode.
* **SDK disabled by default**, opting-in required.

### Opting-out

In order to opt-out from SDK, simply call:

```js
import { Batch } from '@batch.com/react-native-plugin';

await Batch.optOut();
```

Opting out will:

* Disable any network capability from the SDK
* Disable all In-App campaigns
* Make the Inbox module return an error immediatly when used
* Make the SDK reject any editor calls
* Make the SDK reject calls to `batch.user.trackEvent()`, `batch.user.trackTransaction()`, `batch.user.trackLocation()` and any related methods

Even if you opt-in afterwards, data generated (such as user data or tracked events) **while** opted out **WILL** be lost.

You can also wipe the SDK installation data:

```js
import { Batch } from '@batch.com/react-native-plugin';

await Batch.optOutAndWipeData();
```

This will wipe the data locally and request a remote data removal for the matching Installation ID and its associated data.\
Any user-level data associated with the Custom User ID (if any) set via our server APIs will **not** be deleted. However, the Installation ID <> Custom User ID association will be, effectively logging the user out before deleting their installation data.\
Sending notifications to this user using their Advertising ID (via the Transactional API or a Custom Audience) will not be possible for a month.

### Disabling the SDK by default

In order to disable the SDK by default do the following:

On Android, add the following meta-data entry to your AndroidManifest's `<application>` tag:

```xml
<meta-data android:name="batch_opted_out_by_default" android:value="true" />
```

On iOS, add the following key in your `Info.plist`.

```xml
<key>BATCH_OPTED_OUT_BY_DEFAULT</key>
<true/>
```

If you are using Expo, you can update the app configuration file as following :

{% code title="app.json" %}

```json
{
  "expo": {
    ...,
    "plugins": [
      [
        "@batch.com/expo-plugin",
        {
          "androidApiKey": "YOUR_ANDROID_BATCH_API_KEY",
          "iosApiKey": "YOUR_IOS_BATCH_API_KEY",
          "enableDefaultOptOut": true
        }
      ]
    ]
  }
}
```

{% endcode %}

### Opting-in

Once you've opted-out (either programmatically, or by default), you can re-enable the SDK by calling the following:

```js
import { Batch } from '@batch.com/react-native-plugin';

await Batch.optIn();
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.batch.com/developer/sdk/react-native/data-privacy/opt-out.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
