# CCPA - Privacy String

The California Consumer Privacy Act of 2018 ([CCPA](https://iabtechlab.com/standards/ccpa/)) protects the personal information of California residents. It applies to all businesses operating in California. If a California resident uses an app developer's mobile app, CCPA applies to the developer and all relevant partners that process users' personal information.

## Setting the IAB US Privacy String

DT recommends that the first time you gather a user's opt-out (consent), pass it to the SDK before initializing it. The SDK considers the user's opt-out when initializing.

To set the IAB US privacy string using the following API:

{% tabs %}
{% tab title="Android" %}
{% code title="Java" %}

```java
String privacyString = "1YNN";
UserInfo.setIabUsPrivacyString(privacyString, context);
```

{% endcode %}
{% endtab %}

{% tab title="iOS" %}
{% code title="Swift" %}

```swift
FairBid.user().iabusPrivacyString = "1YNN"
```

{% endcode %}

{% code title="Objective-C" %}

```objective-c
[FairBid user].IABUSPrivacyString = @"1YNN";
```

{% endcode %}
{% endtab %}

{% tab title="Unity" %}
{% code title="C#" %}

```csharp
var privacyString = "1YNN";
    UserInfo.SetIabUsPrivacyString(privacyString);
```

{% endcode %}
{% endtab %}
{% endtabs %}

To determine what value to use for the US Privacy String, see [IAB US Privacy String](https://github.com/InteractiveAdvertisingBureau/USPrivacy/blob/master/CCPA/US%20Privacy%20String.md).

Valid values include:

* `1---`: CCPA does not apply, for example, the user is not a California resident.
* `1YNN`: User does NOT opt out, ad experience continues.
* `1YYN`: User opts out of targeted advertising.

## Clearing Privacy Opt-Out

To clear the user opt-out setting, use the following API:

{% tabs %}
{% tab title="Android" %}
{% code title="Java" %}

```java
UserInfo.clearIabUsPrivacyString(context);
```

{% endcode %}
{% endtab %}

{% tab title="iOS" %}
{% code title="Swift" %}

```swift
FairBid.user().clearIABUSPrivacyString();
```

{% endcode %}

{% code title="Objective-C" %}

```objective-c
[[FairBid user] clearIABUSPrivacyString];
```

{% endcode %}
{% endtab %}

{% tab title="Unity" %}
{% code title="C#" %}

```csharp
UserInfo.ClearIabUsPrivacyString();
```

{% endcode %}
{% endtab %}
{% endtabs %}
