API
setupCookiebot
This function will make sure that the Cookiebot script is injected with the right parameters.
Property | Required | Description |
---|---|---|
cbid | Yes | The cookiebot id, which can be retrieved from the account |
language | Yes | The language in which the banner content should be displayed |
autoBlockingMode | No (default true) | Auto block scripts that set cookies |
onMarketingAccept | No | Function which will be called when marketing cookies have been accepted |
onNecessaryAccept | No | Function which will be called when necessary cookies have been accepted |
onPreferencesAccept | No | Function which will be called when preference cookies have been accepted |
onStatisticsAccept | No | Function which will be called when statistic cookies have been accepted |
loadScript
This function can be used to programmatically inject a script.
Property | Required | Description |
---|---|---|
element | Yes | The DOM reference on which the script will be injected as child |
src | Yes | The src url of the script |
attributes | Yes | Attributes that are placed on the script tag |
getCookiebotInstance
The native Cookiebot instance can still be accessed by invoking this function.
javascript
import { getCookiebotInstance } from "@xerius/codey-cookiebot";
console.log(getCookiebotInstance().consented);
Data automation id's
Name | Description |
---|---|
cookiebanner | The cookiebot banner |
cookiebot-accept | The accept all cookies button |