Behavior

Window for recollecting consent

By default, consent is automatically re-collected and the notice is displayed again in three cases:
    After 13 months (maximum acceptable cookie lifetime)
    When the user clears they browser cookies
    When a new vendor is added in your tag configuration or in the IAB vendors list (if you choose the option all)
The third case (a new vendor is added) can happen pretty often so you have the option to choose a number of days during which the notice will not be displayed even though there are new vendors to collect consent for. By default, the number is zero and the notice will be displayed automatically if a new vendor is added. If you create notices through the Didomi Console, the default value is 30 days.
During that consent recollection window:
    New users will be asked for consent for the new vendor immediately.
    Previous users that had already given consent within the window (ie less than X days ago) will not be asked again until the expiration of the window. The new vendor will not have vendor during that time.
    Previous users that had already given consent outside of the window (ie more than X days ago) will be asked again immediately.
1
<script type="text/javascript">
2
window.didomiConfig = {
3
notice: {
4
daysBeforeShowingAgain: 5 // Number of days. Default is 0
5
}
6
};
7
</script>
Copied!
If you choose that option and because the notice is not shown again, the user consent status will be partial and some vendors will not have consent information. The function Didomi.isUserConsentStatusPartial() can return true in these cases.

Recollect consent after a certain date

In some cases, you might want to force recollect consent for all users after a certain date, irrespective of their choices and the configured window for recollecting consent.
This can be achieved by setting an ISO8601 date in the user.ignoreConsentBefore property:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
user: {
4
ignoreConsentBefore: "2020-09-09T00:00:00Z"
5
}
6
};
7
</script>
Copied!
When the user has given consent before the provided date, consent will be automatically recollected. Dates in the future are ignored until they become current so you can schedule a consent recollection for a specific date in the future.

Consent expiration

Didomi CMP allows you to customize the lifetime of the consent so that it expires after a specific time.
You can use app.consentDuration configuration option to specify custom consent duration:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
app: {
4
consentDuration: 100 // Custom consent duration in seconds
5
}
6
};
7
</script>
Copied!
The app.consentDuration configuration option accepts custom consent duration value in seconds.
Consent expires after 12 months by default if custom consent duration is not specified.
The lifetime of the cookies is set to the value specified in the consent duration configuration option. If the custom consent duration is not specified, the lifetime of the cookies will be set to 12 months by default.
It is possible to apply a specific consent expiration when the user denies consent for all purposes and vendors. This can be done by using the app.deniedConsentDuration configuration option:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
app: {
4
deniedConsentDuration: 100 // Denied consent duration in seconds
5
}
6
};
7
</script>
Copied!
If this configuration option is used and the user disagrees to all vendors and purposes on the consent legal basis, the consent will expire after the specified denied consent expiration and the consent will be recollected. The user choices on the legitimate interest legal basis are not taken into account when applying this configuration option.
The denied consent duration value should be smaller than the generic consent duration value, otherwise, the denied consent expiration will be ignored.
The app.deniedConsentDuration configuration option accepts a custom consent duration value in seconds.
If no value is set for the denied consent duration, the generic consent duration will still be applied for the denied consents.

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.

Notice country

If you want to specify the country which determines the policy, you can use the app.country configuration option:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
app: {
4
country: 'fr' // Two-letter country code
5
}
6
};
7
</script>
Copied!
The app.country configuration option receives a string which is an ISO 3166-1 alpha-2 country code.
The value specified in the app.country configuration option is used for the IAB TCF v2 consent string and for the IAB TCF v2 __tcfapimethod.
You can read more about it in our Reference section.

Configuration by user country

If you want to apply a different configuration depending on the country that the user is from, you can add country-specific properties in a configByCountry property where each key is an ISO 3166-1 alpha-2 country code in uppercase (the country code is case-sensitive). This allows you to replace part or all of the configuration for some countries.
Example to force the language based on the user country instead of the user browser configuration, and modify vendors:
1
<script type="text/javascript">
2
window.didomiConfig = {
3
// Visitors from countries other than FR or US will get this configuration
4
languages: {
5
enabled: ['fr', 'en'], // Enable both French and English for all users
6
},
7
app: {
8
name: 'My Website',
9
vendors: {
10
iab: {
11
all: true,
12
exclude: [9],
13
}
14
}
15
},
16
configByCountry: {
17
// Visitors from France will get the global configuration + these changes applied to it
18
FR: {
19
languages: {
20
enabled: ['fr'] // Force French for visitors from France
21
},
22
app: {
23
vendors: {
24
iab: {
25
all: false,
26
include: [9],
27
exclude: [] // It's important to override "exclude" here otherwise it would be kept as [9]
28
}
29
}
30
}
31
},
32
// Visitors from the US will get the global configuration + these changes applied to it
33
US: {
34
languages: {
35
enabled: ['en'] // Force English for visitors from the US
36
}
37
// Vendors are not specified here so the global vendors will apply (all IAB)
38
}
39
}
40
};
41
</script>
Copied!
The properties defined in configByCountry are merged with the rest of the configuration when the user comes from the matching country. The properties from the country configuration override the properties defined globally and are merged recursively so make sure to fully override objects when necessary. Arrays are replaced and not merged or concatenated.
Last modified 6mo ago