Skip to content

Installation

This NPM package allow an easier integration of Cookiebot.

Installation when using Vue or Angular

This is the recommended approach for single page applications within Xerius. The installation is done by running following command:

bash
npm i @xerius/codey-cookiebot

The setup is done by including following code. This will make sure the user views the banner on first visit

javascript
import { setupCookiebot } from "@xerius/codey-cookiebot";

setupCookiebot({
  cbid: "33655448-1393-4b43-8126-e8b9cd543ac6", // Xerius domain group id
  language: "nl",
  autoBlockingMode: true,
  onMarketingAccept: () => console.log("marketing accepted"),
  onNecessaryAccept: () => console.log("necessary accepted"),
  onPreferencesAccept: () => console.log("preferences accepted"),
  onStatisticsAccept: () => console.log("statistics accepted"),
});

TIP

Implementing Cookiebot in an Angular application? The autoBlockingMode property should be set to false to prevent the Promise/Observable bug. When auto blocking is turned off, every script should be marked with a data-cookieconsent attribute (more info can be found here).

Installation when using no framework

Does your application not have access to NPM or a bundling setup? The best way to integrate Cookiebot is to include script and stylesheet from the CDN.

https://cdn.xerius.be/cookiebot/x.x.x/cookiebot.umd.cjs

The setup can be done by including this snippet at the head of the HTML.

javascript
window.cookiebot.setupCookiebot({
  cbid: "33655448-1393-4b43-8126-e8b9cd543ac6", // Xerius domain group id
  language: "nl",
  onMarketingAccept: function () {
    console.log("marketing accepted");
  },
  onNecessaryAccept: function () {
    console.log("necessary accepted");
  },
  onPreferencesAccept: function () {
    console.log("preferences accepted");
  },
  onStatisticsAccept: function () {
    console.log("statistics accepted");
  },
});