Functionality
The setDefaultLocale
function allows the publisher to change AdConsent default language to be shown to the user when the user language is not supported by AdConsent. Passing an invalid or unsupported language code will default to 'en'
.
Syntax
function adconsent()
argument name | type | optional | value | description |
---|---|---|---|---|
command | string |
| ||
parameter | string | ✔️ |
| 2-letter country language code. Default value is |
callback | function | ✔️ |
| The callback function that is called with the function call result. |
parameter
This is a string holding the 2-letter code for the country language the publisher wants to act as the fallback language when an user from an unsupported country language lands in the page. 'en'
, 'de'
, 'fr'
, 'pt'
, 'it'
are some of the possibilities to set as default. However, this set of supported languages may change given the consent zone (e.g., GDPR, CCPA) we are going to apply in.
Valid options for each consent zone
GDPR
'cs'
(Czech)'de'
(German)'el'
(Greek)'en'
(English)'es'
(Spanish)'fr'
(French)'hr'
(Croatian)'hu'
(Hungarian)'it'
(Italian)'nl'
(Dutch)'pl'
(Polish)'pt'
(Portuguese)'sv'
(Swedish)
CCPA
Only 'en'
supported.
Description
When an user enters the publisher site from a specific consent zone that needs to open the GUI and uses an unsupported language, AdConsent will fallback to the defined default language to show. This is by default English ('en'
). Using this function will allow the publisher to change it so, e.g., in a generic German-traffic site the default language to show when there's no matching supported language for the user visiting the site is German ('de'
) instead of English.
Scope
The function must be called before AdConsent shows the GUI. Calls after AdConsent has shown the GUI will be ignored.
Example
Setting default language to be German (de)
adconsent('setDefaultLocale', 'de');