---
title: Handle user consent in WebViews - WebView
description: Collect user consent from a WebView with the opt-in and opt-out commands of the Contentsquare tag, when your app can't handle consent through the SDK
source_url:
  html: https://docs.contentsquare.com/en/webview-tracking-tag/privacy/
  md: https://docs.contentsquare.com/en/webview-tracking-tag/privacy/index.md
---

> ## Documentation index
> Fetch the complete documentation index at: https://docs.contentsquare.com/llms.txt
> Use this file to discover all available pages before exploring further.

Manage user consent for WebView tracking using opt-in and opt-out APIs to respect user privacy preferences.

> **Collecting user consent**
>
> By default, user consent should be handled through the SDK. If your application context requires to collect user consent from the WebView, follow the instructions below.

Our mobile SDK considers every new user to be opted-out by default.

You are responsible for creating the UI asking users for their consent and allowing them to manage their privacy settings and then calling the appropriate Contentsquare following methods (`optin` or `opt-out`).

If you think securing user consent is not required for your app, discuss it during the implementation process with your main Contentsquare contact.

## Opt-in

> **Note**
>
> This command is available starting with CSQ SDK Android `0.1.0`, iOS `0.1.0`, Flutter `4.0.0`, React Native `6.0.1`.

Use the Opt-in API to get user consent. Calling this API generates a user ID and initiates tracking.

```javascript
window._uxa = window._uxa || [];
window._uxa.push(["optin"]);
```

## Opt-Out

> **Note**
>
> This command is available starting with CSQ SDK Android `0.1.0`, iOS `0.1.0`, Flutter `4.0.0`, React Native `6.0.1`.

When this API is called, tracking stops immediately, all settings are reset (Session number, Page number...) and all files and directories regarding Contentsquare are deleted. This means that the user ID is deleted. The SDK will never track or collect any data from the user's phone unless the Opt-in API is called again.

```javascript
window._uxa = window._uxa || [];
window._uxa.push(["optout"]);
```


```json
{"@context":"https://schema.org","@type":"TechArticle","headline":"Handle user consent in WebViews","description":"Collect user consent from a WebView with the opt-in and opt-out commands of the Contentsquare tag, when your app can't handle consent through the SDK","url":"https://docs.contentsquare.com/en/webview-tracking-tag/privacy/","inLanguage":"en","dateModified":"2026-10-14T22:32:37+02:00","publisher":{"@type":"Organization","name":"Contentsquare","url":"https://www.contentsquare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://docs.contentsquare.com/#website","name":"Contentsquare Technical Documentation","url":"https://docs.contentsquare.com/"}}
```