Drupal module

A Drupal module that adds ConsentTrustee to your Drupal 10 or 11 site with a proper admin configuration form.

Installation

1. Add the module

Copy the consenttrustee folder into your Drupal modules directory:

# Copy to custom modules
cp -r consenttrustee /path/to/drupal/modules/custom/

2. Enable the module

Enable it through the admin UI at Extend, or use Drush:

drush en consenttrustee

3. Configure

Go to Configuration > System > ConsentTrustee. Enter your domain slug from the ConsentTrustee dashboard. Save the form.

Optional settings on the same page: API URL (for self-hosted instances), language override, and Google Consent Mode v2 toggle with Basic/Advanced mode.

4. Clear cache

Drupal caches page attachments, so clear the cache after saving:

drush cr

Or go to Configuration > Performance and click Clear all caches.

How it works

The module uses hook_page_attachments() to add the ConsentTrustee script to every page as an HTML head element. It skips admin pages automatically, so the banner only appears on the frontend.

Configuration is stored using Drupal's Configuration API, so it exports cleanly with drush config:export and works in multi-environment setups.

Uninstalling

When you uninstall the module, it removes its configuration automatically. Nothing is left behind in the database.

Requirements

  • -Drupal 10 or 11
  • -PHP 8.1 or later
  • -A ConsentTrustee account with a configured domain