enableWelcomeTitle & enableWelcomeText
Functionality
The functions enableWelcomeTitle
and enableWelcomeText
enable a welcome text for the AdConsent GDPR GUI main page, that explains the user in an easy-to-understand way which consent the user is asked for. This text is shown before the fixed legal texts that are required by a IAB certified CMP. The welcome title and text are by default disabled and can be enabled using these functions. The text can be customized with the publishers' own text by using setTranslationFiles.
Syntax
function adconsent.gdpr()
argument name | type | optional | value | description |
---|---|---|---|---|
command | string |
|
| Sets a customizable title in the CMP GUI first layer. |
parameter | - | ✔️ | - | Not applicable. |
callback | function | ✔️ |
| The callback function that is called with the function call result. |
function adconsent.gdpr()
argument name | type | optional | value | description |
---|---|---|---|---|
command | string |
|
| Sets a customizable description in the CMP GUI first layer. |
parameter | - | ✔️ | - | Not applicable. |
callback | function | ✔️ |
| The callback function that is called with the function call result. |
Description
Enabling the title and/or the description text allows the publisher to better customize the CMP appearance and the message to be sent to the user before entering the legal wording paragraphs. AdConsent default is to have these labels disabled, having a general look much like the one below:
When enableWelcomeTitle
is set, a new label heading shows up:
When enableWelcomeTitle
and enableWelcomeText
are set, both a new heading and a new text paragraph show up:
The default texts as seen in the images above are defaults provided by AdConsent and available in all supported languages.These texts are also fully customizable through the setTranslationFiles function, and accept HTML in them for style and/or link customization.
Scope
The function must be called before AdConsent shows the GUI. Calls after AdConsent has shown the GUI will be ignored.
Examples
Setting the CMP GUI to show a welcome title
adconsent.gdpr('enableWelcomeTitle');
Setting the CMP GUI to show a welcome title and text
adconsent.gdpr('enableWelcomeTitle');
adconsent.gdpr('enableWelcomeText');
Setting the CMP GUI to show a welcome title and text, providing a custom translation for them for English
When providing custom translations, multi-language support should be considered as well. As an alternative, if the page focuses on one language only, forceLocale and setDefaultLocale should be considered. This example provides only a translation for English and forces the CMP language to show text only in English as well.
adconsent.gdpr('enableWelcomeTitle');
adconsent.gdpr('enableWelcomeText');
adconsent.gdpr('setTranslationFiles', {
path: 'https://mysite.com/consent/gdpr/translations',
locales: ['en']
});
adconsent.gdpr('forceLocale', 'en');