Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Simple Klaro

Security covered Under active development 355 sites

This module integrates the Klaro consent management software into your Drupal site, allowing you to easily configure its behavior through a simple configuration file. It automatically displays the consent manager on all pages and offers options for styling, customizable links to preferences, and integration with script execution control.

This module provides a simple implementation of the Open Source Consent Management Software Klaro.

Because Klaro is configured using a simple configuration file, this module provides only a field for modifying this configuration. It is useful to add Klaro to a project with a simple configuration module, because this allows to change the configuration without deploying a new version of the website.

The module is called Simple Klaro, because it does not offer a feature rich configuration UI and does not integrate with other modules. An alternative module with a more complex configuration UI and integrations with other modules is here.

How to install

The module uses the klaro library either by CDN or installed via composer. The recommended setup is to install via composer, but this requires some extra steps.

  1. Add the composer merge plugin with composer require wikimedia/composer-merge-plugin
  2. And then add the following to the site's extra section of composer.json:
    "merge-plugin": {
      "include": [
        "docroot/modules/contrib/simple_klaro/composer.libraries.json"
      ]
    }
    

How to use

After enabling this module the consent manager appears automatically on all pages. A permission is provided to bypass Klaro, that can be granted to selected roles.

The consent manager can be integrated with default styles, or without styles, which makes it easy to adapt it to the design of a website.

Also a block is provided with a link to open the consent settings dialog after the settings have been saved. The syntax of the link is <a href="#" id="klaro-preferences">Cookie preferences</a>. Any HTML element with the id klaro-preferences will open the dialog, so a custom button can easily be created.

When the settings of Klaro are changed, all caches are cleared and the changed settings are applied on all pages.

Using the settings the appearance, the applications, all texts, and translations can easily be configured. Translations are displayed based on the lang attribute of the html element. The execution of scripts on the website is by default controlled by changing the script type from text/plain to application/javascript, when the corresponding consent setting is toggled. Additionally, custom callback functions can be invoked. When consent is revoked, cookies can be deleted with regular expressions.

Screenshots

Below are some screenshots of different configurations with and without custom styling.

Drupal 9–11

Ask your assistant about Simple Klaro

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
12
Tracked since
Jan 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 6
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
1.9.0 Stable 9–10 Jan 23, 2023
1.8.0 Stable 9–10 Jan 23, 2023