# GDPR

The General Data Protection Regulation ([GDPR](https://gdpr.eu/)) requires you to scope your user's consent. A user falls within the GDPR scope for your app when one more of the following applies:

* The user is currently located in the European Union (EU).
* The user registers with the app as an EU resident.
* The app specifically targets EU users.

For more information about how DT applies GDPR, see [GDPR](https://docs.digitalturbine.com/dt-fairbid/privacy/gdpr).

DT recommends that the first time you gather a user's consent, pass it to the DT FairBid SDK before initializing it. The SDK considers the user's consent when initializing. For future sessions, call the API if the user updates their consent, as the SDK caches the consent.

{% hint style="warning" %}
If you do not pass the user's consent to the DT FairBid SDK, the SDK only shows contextual ads to that user, which might negatively reduce your revenue.
{% endhint %}

## User Consent Given

To indicate that the user gives consent, use the following API:

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

```java
UserInfo.setGdprConsent(true, context);
      // true or YES if you have the user’s consent
```

{% endcode %}
{% endtab %}

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

```swift
FairBid.user().gdprConsent = true
```

{% endcode %}

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

```objective-c
[FairBid user].GDPRConsent = YES;
```

{% endcode %}
{% endtab %}

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

```csharp
UserInfo.SetGdprConsent(true);
```

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

## User Consent NOT Given

To indicate that the user does not give consent, use the following API:

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

```java
UserInfo.setGdprConsent(false, context);
      // false or NOT if you do not have the user’s consent
```

{% endcode %}
{% endtab %}

{% tab title="iOS" %}
DT does not support this option for iOS.
{% endtab %}

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

```csharp
UserInfo.SetGdprConsent(false);
```

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

## \[Optional] Additional User Consent String

To pass an optional consent string, use the following API:

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

```java
String consentString = "BOEFEAyOEFEAyXXXXXXI4AAAB9vABAASA";
UserInfo.setGdprConsentString(consentString, this);
```

{% endcode %}
{% endtab %}

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

```swift
FairBid.user().gdprConsentString = "BOEFEAyOEFEAyXXXXXXI4AAAB9vABAASA"
```

{% endcode %}

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

```objective-c
[FairBid user].GDPRConsentString = @"BOEFEAyOEFEAyXXXXXXXI4AAAB9vABAASA";
```

{% endcode %}
{% endtab %}

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

```csharp
var consentString = "BOEFEAyOEFEAyXXXXXXI4AAAB9vABAASA";
UserInfo.SetGdprConsentString(consentString);;
```

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