How to become GDPR compliant using Cookiebot

This article explains how to implement CookieBot with Umbraco Engage to comply with GDPR.

Integrating a cookie consent banner service such as CookieBot allows you to configure parts of Umbraco Engage based on user consent.

This article gives you a working implementation to use with CookieBot.

Cookiebot in Umbraco.
Cookiebot in Umbraco.

Code Example

The code example below shows how to create the backend code to read the CookieBot consent cookie from the end user. Based on that, decide which features of Umbraco Engage it should enable or disable.

  1. Create a class that implements the Umbraco.Engage.Infrastructure.Permissions.ModulePermissions.IModulePermissions interface.

  2. Check the current HTTPContext Request Cookies for the CookieBot cookie, which is named CookieConsent.

From some of the documentation from CookieBot, implement the same logic to check if the value of the cookie is -1 or another value. If it is set to -1, CookieBot is indicating to us that this is a user within a region that does not require consent.

The rest of the code is deserializing the JSON string stored inside the cookie from CookieBot. It maps to the relevant cookie permission used for turning Umbraco Engage features on or off.

CookieBotModulePermissions.cs

CookieBotComposer.cs

The existing CookieBot cookie Keys are mapped to the following Umbraco Engage features:

CookieBot Key

Umbraco Engage Features

Preferences

Personalization

Statistics

Analytics

Marketing

A/B Testing

Configuring CookieBot

For information on setting up and configuring your Cookie Consent Banner, see the Cookiebot Documentation. It contains information on changing the wording and the look and feel of the cookie consent banner.

Installing CookieBot

To install CookieBot, insert the JavaScript tag provided by CookieBot into the <head> of your HTML template:

Tracking a Visitor's Initial Pageview

Umbraco Engage does not actively track visitors until they have given their consent to the Cookiebot configuration. After the visitor consents, you need to reload the page to track the visit. If no reload is performed, the visitor's referrer and/or campaign information will not be tracked.

Use JavaScript to reload the page when consent is given by handling the CookiebotOnAccept event:

Calling the above method will preserve any referrers and query strings supplied in the current request. It results in Umbraco Engage processing the current page visit and visitor correctly.

For more details, see the Cookiebot Documentation.

Last updated

Was this helpful?