Extended Configuration
This is an example of an extended configuration.
What is shown here
- Forcing specific language – Slovak (using
defaultLang
), ie. disabling auto-detection (autodetectLang
) - Setting multiple company names in the consent text (
companyNames
) - Using
force
as adisplayMode
instead ofsoft
(which is used in other examples) - Using
showSettings
as asecondaryButtonMode
instead of defaultacceptNecessary
-
Overwriting raw configuration of the underlying cookie-consent component (via
config
option), to modify some advanced features. - Clearing localStorage when user gives consent to only necessary data (
onFirstAccept
) - Clearing localStorage when user updates consent and rejects some consent category (
onChange
) - Using
cookieTable
configuration to list cookies in the settings modal - Overriding default translation (
translationOverrides
) for consent modal title - Etc.
See page source for details.
Use cookieConsent instance
When callbacks don't satisfy your needs for conditional code execution, you can also store cookieConsent instance in a variable and access it later when needed – see source code.
Example link with conditional logic activated onclick
(see browser console – note difference with and without accepted consent)