# User Profile Settings

Profile information for users managed by the DFINERY server. All of this information is optional and is not stored on the terminal. [SDK integration](https://docs.dfinery.ai/developer-guide/platform/web/integration) must be done first.

### Before you start <a href="#undefined" id="undefined"></a>

Before setting up a user profile, create and link user profile properties in the [DFINERY console](https://console.dfinery.ai/). User profile properties can be created in Additional Settings / Data Linkage / Property Management / User Profile Property List.

### Note <a href="#undefined-1" id="undefined-1"></a>

* If an unregistered user profile or an incorrect type of user profile property is recorded, the user profile will not be set.
* `Array of String`You can create up to 10 user profile properties of a type.
* `Array of Long`, `Array of Double`you can create up to 5 types.
* There is no limit to the number of values ​​entered, but the total size cannot exceed 8KB.

### Set up <a href="#undefined-2" id="undefined-2"></a>

You can set user profiles using the `Dfinery.setUserProfile()` method or `Dfinery.setUserProfiles()`.

### User profile properties

| Constant                   | User profile attribute name | Detail          |
| -------------------------- | --------------------------- | --------------- |
| `DFUserProfile.BIRTH`      | df\_birth                   | User's birthday |
| `DFUserProfile.GENDER`     | df\_gender                  | User gender     |
| `DFUserProfile.NAME`       | df\_name                    | User name       |
| `DFUserProfile.MEMBERSHIP` | df\_membership              | User membership |

### Set by item

```javascript
setUserProfile(key, value);
```

Each parameter means:

* `key`: The name of the user profile attribute to set. `String`A value of type can be entered.
* `value`: The value of the user profile to be set. `null`You can also enter it.

### Set up multiple items at once

```javascript
setUserProfiles(profiles)
```

Each parameter means:

* `profiles`: Dictionary with keys and values ​​of user profile attribute information

```javascript
const profiles = {};
profiles[DFUserProfile.NAME] =  "TestName";
profiles[DFUserProfile.GENDER] = DFGender.MALE;
profiles[DFUserProfile.BIRTH] = "2014-05-14";
profiles[DFUserProfile.MEMBERSHIP] = "VIP";
Dfinery.setUserProfiles(profiles);
```

### Example of use <a href="#undefined-5" id="undefined-5"></a>

#### Set a name <a href="#undefined-6" id="undefined-6"></a>

* Support Type
  * value : `String`

{% tabs %}
{% tab title="Javascript" %}

```javascript
Dfinery.setUserProfile(DFUserProfile.NAME, "John");
```

{% endtab %}
{% endtabs %}

#### Set gender <a href="#undefined-8" id="undefined-8"></a>

* Parameter Support Type
  * value : `DFGender.MALE`, `DFGender.FEMALE`, `DFGender.NON_BINARY`, `DFGender.OTHER`

{% tabs %}
{% tab title="Javascript" %}

```javascript
Dfinery.setUserProfile(DFUserProfile.GENDER, DFGender.MALE);
```

{% endtab %}
{% endtabs %}

### Set up your membership

* Support Type
  * value : `String`

{% tabs %}
{% tab title="Javascript" %}

```javascript
Dfinery.setUserProfile(DFUserProfile.MEMBERSHIP, "VIP");
```

{% endtab %}
{% endtabs %}

### Set your date of birth

* Support Type
  * value : `String(yyyy-MM-dd)`

{% hint style="warning" %}
dfFor df\_birth (date of birth), please enter the input value type as a String type of yyyy-MM-dd. Example: "1999-01-01"
{% endhint %}

{% tabs %}
{% tab title="Javascript" %}

```javascript
Dfinery.setUserProfile(DFUserProfile.BIRTH, "1999-01-01");
```

{% endtab %}
{% endtabs %}

#### Set consent information for receiving notifications <a href="#consent" id="consent"></a>

Consent to receive notifications is part of the user profile and you can set consent values ​​for various channels.

{% hint style="danger" %}
If you do not set the consent information for receiving notifications, the value is null. When it is null and true, notifications can be sent, and when it is false, notifications cannot be sent. For more information, please refer to [the user guide.](https://docs.dfinery.ai/user-guide/action/off-site-campaign/opt-state)
{% endhint %}

{% hint style="info" %}
User profiles for consent to receive notifications are automatically registered when creating a service in DFINERY, so they can be set up without having to set them in the DFINERY console.
{% endhint %}

* Support Type
  * key : Notification consent type (DFUserProfile)
  * value : `Boolean`

{% tabs %}
{% tab title="Javascript" %}

```javascript
// Set advertising notification consent for push channel
Dfinery.setUserProfile( DFUserProfile.PUSH_ADS_OPTIN, true);
```

{% endtab %}
{% endtabs %}

#### **Types of consent to receive notifications** <a href="#consent-type" id="consent-type"></a>

{% hint style="warning" %}
Between 9 PM and 8 AM, separate nighttime advertising notification consent is required to send advertising notifications, so if you want to send messages during that time, please use the `PUSH_NIGHT_ADS_OPTIN` value to obtain consent. (Guide to the Information and Communications Network Act to Prevent Illegal Spam, Korea Internet & Security Agency, July 2020)
{% endhint %}

| Designation                          | Channel     | Explanation                                                         |
| ------------------------------------ | ----------- | ------------------------------------------------------------------- |
| `DFUserProfile.PUSH_OPTIN`           | push        | Consent to receive informational notifications for push channels    |
| `DFUserProfile.PUSH_ADS_OPTIN`       | push        | Consent to receive promotional notifications for push channels      |
| `DFUserProfile.PUSH_NIGHT_ADS_OPTIN` | push        | Consent to nightly promotional notifications for push channels      |
| `DFUserProfile.SMS_ADS_OPTIN`        | message     | Consent to receive promotional notifications for text channels      |
| `DFUserProfile.KAKAO_ADS_OPTIN`      | Friend Talk | Consent to advertising notifications for Kakao Friends Talk channel |

#### Setting up a custom user profile <a href="#undefined-15" id="undefined-15"></a>

If you want to set up a custom user profile, you can do so by creating a property for the custom user profile in the [DFINERY console](https://console.dfinery.ai/login) and entering it as a key value.

* Support Type
  * key : `String`
  * value : `String`, `Boolean`, `Number`, `Date`, `Array of String`, `Array of Number`

{% tabs %}
{% tab title="Javascript" %}

```javascript
Dfinery.setUserProfile("{CUSTOM_PROFILE_KEY}", "{CUSTOM_PROFILE_VALUE}");
```

{% endtab %}
{% endtabs %}
