useCookiebot()

The API for the composable works the same for Vue and Nuxt alike.

Al these properties are available inside the useCookiebot composable.

consentBanner

consentBanner: () => Promise<void>

Create script tag for the consent banner and append it to body

Returns

Promise<void>


consentPage Deprecated

consentPage: (ref: MaybeRef<null | HTMLElement>) => Promise<void>

Method to append cookie declaration content to a given HTML element

Param

HTML element or HTML element ref where the script should be injected

Deprecated

Please use cookieDeclaration instead

Parameters
NameTypeDescription
refMaybeRef<null | HTMLElement>HTML element or HTML element ref where the script should be injected
Returns

Promise<void>

Deprecated

Please use cookieDeclaration instead


cookieDeclaration

cookieDeclaration: (ref: MaybeRef<null | HTMLElement>) => Promise<void>

Method to append cookie declaration content to a given HTML element

Param

HTML element or HTML element ref where the script should be injected

Parameters
NameTypeDescription
refMaybeRef<null | HTMLElement>HTML element or HTML element ref where the script should be injected
Returns

Promise<void>


destroyConsentBanner

destroyConsentBanner: () => Promise<void>

Destroy the consent banner script from the body

Returns

Promise<void>


destroyConsentPage Deprecated

destroyConsentPage: (ref: MaybeRef<null | HTMLElement>) => Promise<void>

Method to destroy script for cookie declaration

Param

HTML element or HTML ref where the script has been injected

Deprecated

Please use destroyCookieDeclaration instead

Parameters
NameTypeDescription
refMaybeRef<null | HTMLElement>HTML element or HTML ref where the script has been injected
Returns

Promise<void>

Deprecated

Please use destroyCookieDeclaration instead


destroyCookieDeclaration

destroyCookieDeclaration: (ref: MaybeRef<null | HTMLElement>) => Promise<void>

Method to destroy script for cookie declaration

Param

HTML element or HTML ref where the script has been injected

Parameters
NameTypeDescription
refMaybeRef<null | HTMLElement>HTML element or HTML ref where the script has been injected
Returns

Promise<void>


renew

renew: () => void

Trigger the consent banner to change already given consent

Returns

void


resetConsentBanner

resetConsentBanner: () => Promise<void>

Destroys the consent banner and reinitialises it.

Returns

Promise<void>