Preferences
This section describes how to configure the Didomi consent notice through its programmatic API and the window.didomiConfig object.
Most configuration options are available through the Didomi Console and this documentation only applies to edge cases or custom implementations that require it.

Introduction

Preferences popup that opens when the user clicks on "Learn more"
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 on your website to open it.

Open the popup

By default, the popup can be open from the banner if the user wants to get more information.
We recommend that you also add a link to your website (in the menu or in the privacy policy) to let the user update his or her preferences.
You can do so by calling the Didomi.preferences.show() function.
Example with a link:
1
<a href="javascript:Didomi.preferences.show()">Manage my privacy preferences</a>
Copied!

Privacy Policy

Our default text includes a link to your privacy policy. You can set that URL with the app.privacyPolicyURL property.
Example:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
app: {
4
apiKey: '<Your API key>',
5
privacyPolicyURL: 'https://privacy.didomi.io/'
6
}
7
};
8
</script>
Copied!

Text & Macros

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.subText
Text between the 'View all partners' button and the footer
preferences.content.viewAllPartners
'View all partners' button
preferences.content.agree
'Agree' buttons
preferences.content.disagree
'Disagree' buttons
Example:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
app: {
4
apiKey: '<Your API key>'
5
},
6
preferences: {
7
content: {
8
text: {
9
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. [...]',
10
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. [...]'
11
},
12
title: {
13
en: 'Welcome to our website',
14
fr: 'Bienvenue sur notre site'
15
},
16
disagreeToAll: {
17
en: 'Disagree to all',
18
fr: 'Refuser tout'
19
},
20
agreeToAll: {
21
en: 'Agree to all',
22
fr: 'Accepter tout'
23
},
24
save: {
25
en: 'Save',
26
fr: 'Sauvegarder'
27
},
28
viewAllPartners: {
29
en: 'View all partners',
30
fr: 'Voir nos partenaires'
31
},
32
agree: {
33
en: 'Agree',
34
fr: 'Accepter'
35
},
36
disagree: {
37
en: 'Disagree',
38
fr: 'Refuser'
39
}
40
}
41
}
42
};
43
</script>
Copied!
Note that you should provide translations for all the languages that your website supports. We provide translations for all our standard messages.

Macros

You can use macros that will get replaced with the actual value configured when the text gets rendered.
Macro
Value
Description
{privacyPolicyURL}
app.privacyPolicyURL
Privacy Policy URL
{websiteName}
app.name
Name of your website

Disable Agree/Disagree to all buttons

By default, we display "Agree to all" and "Disagree to all" buttons at the bottom of the list of purposes to allow the user to agree or disagree in a single click:
You can disable these buttons and only display the Save button to force the user to make individual choices by purpose by switching enableAllButtons to false . In that case, the user will have to manually agree/disagree to each purposes:
Example:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
preferences: {
4
enableAllButtons: true,
5
}
6
};
7
</script>
Copied!

Configuring legitimate interest legal basis status

After clicking on the Disagree to all button in the purposes screen, all purposes' and vendors' consents and legitimate interests are disabled by default.
To keep legitimate interests enabled after clicking on the Disagree to all button, preferences.denyAppliesToLI should be set to false in the Didomi configuration object:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
preferences: {
4
denyAppliesToLI: false
5
}
6
};
7
</script>
Copied!

Purposes

Order of purposes

You can control the order in which purposes should be displayed.
This can be done by adding an array of purposes in the preferences.categories property in the didomiConfig object. 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.
didomi_config.json
1
<script type="text/javascript">
2
window.didomiConfig = {
3
preferences: {
4
categories: [
5
{
6
type: 'purpose',
7
purposeId: 'cookies'
8
},
9
{
10
type: 'purpose',
11
purposeId: 'advertising_personalization'
12
},
13
{
14
type: 'purpose',
15
purposeId: 'ad_delivery'
16
}
17
]
18
}
19
};
20
</script>
Copied!
Configuration Key
Type
Description
preferences.categories[index].type
String
Type of the entity to be displayed. If you are specifying a purpose, this key should have purpose value.
preferences.categories[index].purposeId
String
Purpose ID to be displayed in that position. See Vendors and purposes for a list of available purposes.

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, the preferences.categories configuration option in the Didomi configuration can be used:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
preferences: {
4
categories: [
5
{
6
id: 'category-id',
7
type: 'category',
8
name: {
9
en: 'Category name'
10
},
11
description: {
12
en: 'Category description'
13
},
14
children: [
15
{
16
type: 'purpose',
17
purposeId: 'cookies'
18
}
19
]
20
}
21
]
22
}
23
};
24
</script>
Copied!
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 and/or categories 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, thepreferences.clickcategoryagree Didomi event will be dispatched. Similarly, if the user has disagreed with the whole category, the preferences.clickcategorydisagree Didomi event will be dispatched.
Read our Events section for more information:

Information screen

You can embed an intermediate information screen that shows when the user clicks on "Learn More" in the consent notice. That information screen will be displayed before the Preferences screen where the user can give consent per purpose. Example:
Information screen
To enable the information screen with a custom message as well as a custom text for the buttons per language :
1
<script type="text/javascript">
2
window.didomiConfig = {
3
preferences: {
4
information: {
5
enable: true,
6
7
content: {
8
text: {
9
en: 'Information in English',
10
fr: 'Information en français'
11
},
12
learnMore: {
13
en: 'Learn More',
14
fr: 'En savoir plus'
15
},
16
agreeAndClose: {
17
en: 'Agree and Close',
18
fr: 'Accepter et Fermer'
19
}
20
}
21
}
22
}
23
};
24
</script>
Copied!
There is no default text for the information screen so you must specify one or the screen will be empty.

Vendors screen

Vendors screen
By clicking on the View our partners button, you will access this screen where you can block certain vendors.

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
preferences.content.subTextVendors
Text between the list of vendors and the footer
preferences.content.authorizeVendors
Authorize buttons
preferences.content.blockVendors
Block buttons

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.
1
<script type="text/javascript">
2
window.didomiConfig = {
3
notice: {
4
enable: false
5
},
6
preferences: {
7
showWhenConsentIsMissing: true
8
}
9
};
10
</script>
Copied!

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.
1
<script type="text/javascript">
2
window.didomiConfig = {
3
preferences: {
4
canCloseWhenConsentIsMissing: true
5
}
6
};
7
</script>
Copied!

Vendors and purposes

You must configure the vendors for which consent is collected by our consent notice and displayed in the preferences popup.
Read our detailed section to see how they can be configured.
Last modified 6mo ago