# Customize the preferences popup

The "Preferences" pop-in allows the user to manage his or her preferences in terms of consent given by purpose and by vendor. By default, it is shown when the user clicks on "Learn more" in the notice (banner or popin) and we recommend adding a link in your app to open it.

You can customize the texts from that screen.

## Purposes

<figure><img src="https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-142d1ef0b3eee74ed32b95ff251de40fbb562fd1%2FScreenshot_1742978760.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

![](https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-389d1f7724a9c151e6d65593024ddf91d0025ed0%2Fdevice-2021-02-16-213009.png?alt=media)

### Order of purposes

You can control how purposes should be displayed, such as preferred order, icons, etc.

This can be done by adding an array of purposes in the `preferences.categories` property in the `didomi_config.json` file. The order in which items are added to this array will be the same order in which purposes will be displayed in based on their `purposeId`.

Purposes that are required by some vendors and that are not included in the list will be appended to the end of the list in alphabetical order to make sure that all required purposes are displayed and that consent is correctly collected.

{% code title="Custom JSON" %}

```javascript
{
    "preferences": {
        "categories": [{
            "type": "purpose",
            "purposeId": "cookies",
            "icon": "PurposeIcon1"
        }, {
            "type": "purpose",
            "purposeId": "advertising_personalization",
            "icon": "PurposeIcon2"
        }, {
            "type": "purpose",
            "purposeId": "ad_delivery",
            "icon": "PurposeIcon3"
        }]
    }
}
```

{% endcode %}

| Configuration Key                         | Type   | Description                                                                                                                                                                                                                             |
| ----------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `preferences.categories[index].type`      | String | Type of the entity to be displayed. If you are specifying the purpose, this key should have `purpose` value                                                                                                                             |
| `preferences.categories[index].purposeId` | String | Purpose ID to be displayed in that position. See [Vendors and purposes](https://gitlab.com/didomi/developers-documentation/-/blob/main/docs/cmp/mobile-sdk/consent-notice/broken-reference/README.md) for a list of available purposes. |
| `preferences.categories[index].icon`      | String | Reference to an icon image loaded from the app.                                                                                                                                                                                         |

### Categories of purposes

Purposes having a similar functionality can be optionally grouped into categories. This could be useful for better clarity of the purposes screen.

To group purposes into categories, `preferences.categories` configuration option in the Didomi configuration could be used:

{% code title="didomi\_config.json" %}

```javascript
{
  "preferences": {
    "categories": [
      {
        "id": "category-id",
        "type": "category",
        "name": {
          "en": "Category name"
        },
        "description": {
          "en": "Category description"
        },
        "children": [
          {
            "type": "purpose",
            "purposeId": "cookies"
          }
        ]
      }
    ]
  }
}
```

{% endcode %}

Purposes that are required by some vendors and that are not included in one of the specified categories will be appended to the end of the purposes list in alphabetical order so that all required purposes are displayed and that consent is correctly collected for them.

Each category has the following configuration keys:

| Configuration Key      | Type   | Description                                                                                                   |
| ---------------------- | ------ | ------------------------------------------------------------------------------------------------------------- |
| `category.id`          | String | Unique category identifier                                                                                    |
| `category.name`        | Object | An object containing language ISO code as keys and the localized category name as values                      |
| `category.description` | Object | An object containing language ISO code as keys and the localized category description as values               |
| `category.children`    | Array  | An array of purposes which are included in the specified category                                             |
| `category.type`        | String | Type of the entity to be displayed. If you are specifying the category, this key should have `category` value |

If the user has agreed to the whole category, the `PreferencesClickCategoryAgreeEvent` Didomi event will be dispatched. Similarly, if the user has disagreed to the whole category, the `PreferencesClickCategoryDisagreeEvent` Didomi event will be dispatched.

### Text

You can change the content of the popup by setting properties on `preferences.content`.

| Configuration Key                           | Description                                            |
| ------------------------------------------- | ------------------------------------------------------ |
| `preferences.content.text`                  | Main content of the popup                              |
| `preferences.content.title`                 | Title of the popup (Welcome to ...)                    |
| `preferences.content.disagreeToAll`         | 'Disagree to all' button                               |
| `preferences.content.agreeToAll`            | 'Agree to all' button                                  |
| `preferences.content.save`                  | 'Save' button                                          |
| `preferences.content.viewOurPartners*`      | 'View our partners' button                             |
| `preferences.content.viewAllPurposes*`      | 'How we use data' button                               |
| `preferences.content.bulkActionOnPurposes*` | 'Agree to all purposes for the best experience' button |
| `preferences.content.bulkActionOnVendors*`  | 'Agree to all vendors for the best experience' button  |

*\* Fields marked with asterisk are relevant only for TV SDKs for now*

{% code title="didomi\_config.json" %}

```javascript
{
    "preferences": {
        "content": {
            "text": {
                "en": "We and our partners place cookies, access and use non-sensible information from your device to improve our products and personalize ads and other contents throughout this website. [...]",
                "fr": "Nos partenaires et nous déposons des cookies et utilisons des informations non sensibles de votre appareil pour améliorer nos produits et afficher des publicités et contenus personnalisés. Vous pouvez accepter ou refuser ces différentes opérations. [...]"
            },
            "title": {
                "en": "Welcome to our website",
                "fr": "Bienvenue sur notre site"
            },
            "disagreeToAll": {
                "en": "Disagree to all",
                "fr": "Refuser tout"
            },
            "agreeToAll": {
                "en": "Agree to all",
                "fr": "Accepter tout"
            },
            "save": {
                "en": "Save",
                "fr": "Sauvegarder"
            },
            "viewOurPartners": {
                "en": "View our partners",
                "fr": "Voir nos partenaires"
            },
            "viewAllPurposes": {
                "en": "How we use data",
                "fr": "Comment nous utilisons les données"
            },
            "bulkActionOnPurposes": {
                "en": "Agree to all purposes for the best experience",
                "fr": "Accepter toutes les finalités pour avoir une meilleure expérience"
            },
            "bulkActionOnVendors": {
                "en": "Agree to all vendors for the best experience",
                "fr": "Accepter tous les partenaires marketing pour une meilleure expérience"
            }
        }
    }
}
```

{% endcode %}

## Vendors screen

<figure><img src="https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-cbf26e7644fd7bae6ef5b78a4273cf99bcdd33e7%2FScreenshot_1742979172.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

![](https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-ab808a7017ae43c5e29bfba3e9e6b10ff44121d4%2Fdevice-2021-02-16-213115.png?alt=media)

### Text

You can change the content of the popup by setting properties on `preferences.content`.

| Configuration Key                 | Description               |
| --------------------------------- | ------------------------- |
| `preferences.content.textVendors` | Main content of the popup |

## Display when consent is missing

If you want to bypass the notice and display the Preferences popup directly when consent is missing, you can set the property `preferences.showWhenConsentIsMissing` to true. When that is configured, you also need to disable the regular notice to ensure that it will not be displayed by setting `notice.enable` to false.

{% code title="Custom JSON" %}

```javascript
{
  "notice": {
    "enable": false
  },
  "preferences": {
    "showWhenConsentIsMissing": true
  }
}
```

{% endcode %}

## Prevent the popup from being closed when consent is missing

By default, the Preferences popup can be closed at any time, even if the user has not made a choice for some purposes. You can choose to hide the "X" icon and disallow closing the popup until the user has expressed a choice for every purpose by setting `canCloseWhenConsentIsMissing` to `false`.

{% code title="Custom JSON" %}

```javascript
{
    "preferences": {
      "canCloseWhenConsentIsMissing": false
    }
}
```

{% endcode %}

## Allow the Agree to all and Disagree to all buttons to be disabled until the user scrolls to the bottom of the screen

On mobile devices, by adding the `disableButtonsUntilScroll` flag into the preferences section of the config file and setting it to `true`, the `Agree to all` and `Disagree to all` buttons of the Purposes view will be blocked/disabled until the user scrolls to the bottom of the screen in order to see all the purposes.

| Configuration key                     | Type    | Description                                                                                                                                                        |
| ------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| preferences.disableButtonsUntilScroll | Boolean | If true, Agree to all and disagree to all buttons will be disabled until the user scrolls to the bottom. If false or not present, the buttons will not be blocked. |

{% code title="Custom JSON" %}

```javascript
{
    "preferences": {
      "disableButtonsUntilScroll": true
    }
}
```

{% endcode %}

## "Disagree to all" behavior

By default, "Disagree to all" option on preferences screen applies to both consent and legitimate interest. This means that after "Disagree to all" was selected, all purposes and vendors will be disabled, for both consent and legitimate interest data processing.

This behavior can be controlled by setting the `denyAppliesToLI` property. When set to `false`, selecting "Disagree to all" will disable only consent based data processing. Legitimate interest purposes will stil be enabled, as well as legitimate interest based data processing for all vendors.

{% code title="Custom JSON" %}

```javascript
{
    "preferences": {
        "denyAppliesToLI": false
    }
}
```

{% endcode %}

## Display all buttons in bottom bar

By default, on purposes screen on mobile, "Agree to all" and "Disagree to all" buttons are only visible if no choice was made by the user (all purposes are in Unknown state), and "Save" is only visible if the user started to express its choices.

By adding setting the property `preferences.enableAllButtons` to `true`, all these buttons will be visible at all times on this screen.

<figure><img src="https://1703900661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDh8ZWDZrXs8sc4QKEQ%2Fuploads%2Fgit-blob-4443bba61c42502c3c2d90f497ce7aa01325cd18%2FScreenshot_1742978835.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>
