# Advanced settings for Adobe AIR

> Configure advanced settings for Adobe AIR, including GDPR and CCPA compliance, user segmentation, and custom user IDs.

## GDPR - Managing Consent

Unity LevelPlay and network support publisher communication of a user's consent choice, including passing this information to mediated networks (for supported networks).

To use ironSource's API to update a user's consent status, use this functions:

If the user provided consent, set the following flag to true:

```java
IronSource.instance.setConsent(true);
```

If the user did not consent, set the following flag to false:

```java
IronSource.instance.setConsent(false);
```

It's recommended to set the API prior to SDK Initialization.

## CCPA Compliance

Unity LevelPlay platform (SDK Version 6.14.0 and above) supports publishers to restrict the sale of end users personal information under the California Consumer Privacy Act (CCPA).

The notification about personal information of specific users located in California should be handled based on a “do not sell” setting, by setting its value to “true” or “false”.

The API should be set before initializing the SDK.

If the user has opted out of “sale” of personal information:

```java
IronSource.instance.setMetaData("do_not_sell","true");
```

If “sale” of personal information is permitted:

```java
 IronSource.instance.setMetaData("do_not_sell","false");
```

## Set UserID

If you're using server-to-server callbacks to reward your users with our rewarded ad units, you must set the UserID.

> **Note:**
>
> If you want to define the userID manually, you must do this before the init request. You cannot define the userID after the init request.

The userID is a unique identifier for each of your users. You can set the userID parameter, or omit it and let us generate one for you. If you choose to skip setting the userID in your code, the SDK will generate an equitable userID.

We support String (Android) or NSString (iOS) from 1 to 64 characters. Common practice is to use the Google Advertising ID (GAID) or Apple Advertising ID (IDFA).

```java
IronSource.instance.setUserId(YOUR_USER_ID);
```

## Define Segments

You can now customize the way you serve your ads to fit a specific audience. You'll need to inform our servers of the users' details so the SDK will know to serve ads according to the segment the user belongs to.

ironSource supports three methods to convey data to our servers to outline the user segment, namely:

* **Device Properties**: the ironSource SDK collects certain standard parameters that pertain to the users' device automatically such as device model, device manufacturer, app version, and OS. You do not need to convey this data to us
* **User Properties**: user data which is not collected by our SDK (for example, age, gender, or creation date) must be relayed through the API. (See a full list of supported segment properties with descriptions in the following section). Follow the instructions to send us these details so our SDK can apply the relevant ad settings to the segments you defined on the ironSource platform
* **Custom Segments**: you can create a custom segment without conveying user details to our servers and tailor ad settings for that user segment

### Pass User Properties

After you've defined segments on the ironSource platform, you'll need to inform our servers of the user's particulars.

> **Note:**
>
> Segments **must** be set **before** initializing the SDK.

First you must import the ironSource segment class to segment your users:

```java
import com.ironsource.adobeair.IronSourceSegment;
```

Define the properties that will be sent to our servers on which to base the segments. You can transmit this information through **one** of the following methods:

1. If you are familiar with the segment that the user belongs to, enter the segment name:

   ```java
   IronSourceSegment segment = new IronSourceSegment ();
           segment.segmentName = "nameOfSegment";

   ```

2. Send us the user details. ironSource provides a range of standard user properties that you can set to attribute a user to a segment in the API. Scroll down for a table of the support user segment properties.

   ```java
   // Create segment object
   var segment:IronSourceSegment = new IronSourceSegment();
   // Set user age
   segment.age = age;
   // Set user gender
   segment.gender = "gender";
   // Set user's level
   segment.level = levelnumber;
   // Set user creation date
   segment.userCreationDate=creationData
   // Set user's total in-app purchases
   segment.iapt = numberOfInAppPurchases;
   // Set user's paying status, 1 is yes 0 is no
   segment.isPaying = payingStatus;
   ```

   In addition, you can set up to 5 custom user properties per segment:

   ```java
   // Set custom parameters (up to 5)
   segment.setCustom("customKey1", "value1");
   segment.setCustom("customKey2", "value2");
          

   ```

Next, to serve your ad units based on segments, call the following function complete with either the segment name or user properties:

```java
IronSource.instance.setSegment(segment);
```

### Supported User Segment Properties

| **Segment Properties** | **Type**                 | **Limitation**                                                                    | **Description**                                                                                                            |
| ---------------------- | ------------------------ | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| segmentName            | String                   | - alphanumeric - up to 32 letters                                                 | The given name of the segment in your ironSource account                                                                   |
| Age                    | Int                      | 1-99                                                                              | The user's age                                                                                                             |
| Gender                 | String                   | female or male                                                                    | The user's gender                                                                                                          |
| Paying                 | Boolean                  | True or False                                                                     | - True if the user has spent any money on in-app purchases - False if the user has not spent any money on in-app purchases |
| iap\_total             | Double                   | 1-999999.99                                                                       | The total amount of money that the user has spent on in-app purchases                                                      |
| userCreationDate       | Long                     | Cannot be smaller than 0                                                          | The date the user installed the app (for example: \[NSDate date])                                                          |
| Custom Parameters      | key=string, value=string | - ironSource supports up to 5 custom parameters - alphanumeric - up to 32 letters | Any additional data you'd like to dispatch to our server                                                                   |

Register to the following callback to receive the segment name that your user belongs to. If the callback string (segment name) returns empty, there were no correlating segments found for the user in the ironSource Segment module.

```java
IronSource.instance.addEventListener(“onSegmentReceived”, onSegmentReceived);
```

Sample implementation:

```java
function onSegmentReceived(event:DataEvent):void {
                trace (“onSegmentReceived: ” + event.data);
            }
```

## Custom Parameters for Adobe AIR

The ironSource SDK supports the ability for you to pass custom Parameters on the initialization of the Rewarded Video ad unit. You will then receive this data upon user's completion event.

> **Note:**
>
> 1. Custom parameters work only in conjunction with **server-to-server** completion callbacks. You will receive the parameter as part of the callback string.
> 2. You may insert more than one custom parameter to the Init request.

### Implementation Code

#### Rewarded Video

> **Note:**
>
> Custom Parameters can be set several times per session. To reset the value, use clearRewardedVideoServerParameters, and then set the new value.

```java
IronSource.instance.setRewardedVideoServerParameters(YOUR_CUSTOM_PARAMETERS);
```

In addition, you can remove custom parameters for Rewarded Video by calling this function:

```java
IronSource.instance.clearRewardedVideoServerParameters();
```

## Price limitations using waterfall configuration (beta)

Set Waterfall Configuration is an API that can be used to dynamically set limits for the waterfall: price ceiling and price floor. You can use it to set limits and dynamically affect the WF returned per user, resulting in reduced load times and latency.

Limits include, and can be any combination of these parameters:

| Properties | Type   | Description                                                                                   |
| ---------- | ------ | --------------------------------------------------------------------------------------------- |
| ceiling    | double | The price in USD, which defines the maximal eCPM applies to traditional instances             |
| floor      | double | The price in USD, which defines the minimal eCPM applies to traditional instances and bidders |

### Create a waterfall configuration

The WaterfallConfiguration class represents a configuration object for customizing or filtering a waterfall. Implement the following to create a waterfall configuration:

```js
var builder:WaterfallConfigurationBuilder = new WaterfallConfigurationBuilder();
        builder.SetCeiling(ceiling);
        builder.SetFloor(floor);
var configuration:WaterfallConfiguration = builder.Build();
        IronSource.instance.setWaterfallConfiguration(configuration,ISAdFormat.AdUnitName);
```

### Clearing a Waterfall Configuration

It is possible to change the waterfall configuration during the session. To clear the configuration for a given ad unit, use the `empty` WaterfallConfiguration function:

```js
var builder:WaterfallConfigurationBuilder = new WaterfallConfigurationBuilder();
var configuration:WaterfallConfiguration = builder.Build();
IronSource.instance.setWaterfallConfiguration(configuration.Empty(),ISAdFormat.AdUnitName);

```

## ironSource SDK Error Codes

ironSource provides an error feedback mechanism to provide explanation for any failure in the SDK integration. You will receive these errors when something went wrong or an aspect of the integration wasn't completed correctly.

The ironSource Error object contains an **error code** and **message**. These are all the possible errors and their message based on their functions:

| Error Codes | Ad Unit                         | Description                                                                                                                                     |
| ----------- | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 508         | N/A                             | * Init failure of the mediation/Network
* Calling a Demand Only API in non Demand Only mode
* Calling a non Demand Only API in Demand Only mode |
| 509         | - Interstitial
- Rewarded Video | **Show Fail**: No ads to show                                                                                                                   |
| 510         | Interstitial                    | **Load Fail**: Server response failed&#xA;**Load Fail**: Adapters loading failure                                                               |
| 520         | * Interstitial
* Rewarded Video | **Show Fail**: No internet connection; ShouldTrackNetworkState is enabled&#xA;**Show Fail**: No internet connection                             |
| 524         | - Interstitial
- Rewarded Video | **Show Fail**: Placement %@ has reached its limit as defined per pace&#xA;**Show Fail**: Placement %@ has reached its capping limit             |
| 526         | * Interstitial
* Rewarded Video | **Show Fail**: Ad unit has reached its daily cap per session&#xA;**Show Fail**: Ad unit has reached its daily cap per session                   |
| 1022        | Rewarded Video                  | **Show Fail**: Cannot show an RV while another RV is showing                                                                                    |
| 1023        | Rewarded Video                  | **Show Fail**: Show RV called when there are no available ads to show                                                                           |
| 1036        | Interstitial                    | **Show Fail**: Cannot show an interstitial while another interstitial is showing                                                                |
| 1037        | Interstitial                    | **Load Fail**: Cannot load an interstitial while another interstitial is showing                                                                |
