preference

LayoutComponent ❌ Theme ✅ Options ✅ Content & Translations

Overview

The preference component displays a preference and its associated values within a widget. When the parent purpose has one-click consent enabled, this component's values are automatically updated when users toggle the purpose.

When a preference belongs to a purpose with one-click consent enabled:

  • Multi-choice preferences: Values are automatically selected/deselected when the parent purpose is toggled

  • Mono-selection preferences: Not affected by one-click consent, users must make explicit selections

  • User overrides: If a user manually changes a preference value, that explicit choice is preserved even when propagation occurs

Editing preference component

To edit a Preference, you need to edit the layout-component preference and send a PATCH request on /widgets/layout-component/{layout-component-id} and specify the following options in the options property.

Element
Description
Component options

title

Name of the preference. If not empty for a language, it overrides root content created in Preferences library.

description

Description of the preference. If not empty for a language, it overrides root content created in Preferences library.

PATCH https://api.didomi.io/widgets/layout-components/{layout_component_id}?organization_id=YOUR_ORG_ID&widget_id=YOUR_WIDGET_ID

{
    "type": "footer",
    "organization_id": "String",
    "options": {
        "title": {
            "content": {
                "en": "ADD_YOUR_PREFERENCE_TITLE",
                "fr": "TITRE_DE_PREFERENCE"
            }
        },
        "description": {
            "content": {
                "en": "ADD_YOUR_PREFERENCE_DESCRIPTION",
                "fr": "DESC_PREFERENCE"
            }
        }
    }
}

Last updated