Matomo CMP with Digitalist Cloud and CookieHub

Digitalists Matomo SaaS + CookieHub is a quick way to get full control of your consents without loosing any data!
Matomo CMP with Digitalist Cloud and CookieHub
Tomas Persson

Simplifying Cookie Management with Digitalist Cloud

At Digitalist Cloud, we prioritize ease of use for our clients, resulting in significant time savings when using Matomo within our SaaS platform. In this blog post, we detail how our Matomo Tag Manager integrates with CookieHub, a widely-used consent management solution.

This means you add the CookieHub code through the Tag Manager instead of adding it with Javascript code directly in you web application. 

Why We Recommend CookieHub

CookieHub is a robust and straightforward ConsentManager solution that meets EU GDPR requirements. Many of our clients prefer CookieHub for its simplicity and effectiveness in managing user consents.

There are 2 ways do do this.  Simple or Advanced, but before you get started in Matomo make sure you allow 

Simple - Automatic Matomo Cookie Consents in Matomo

This is a very easy way to get started with consent management that supports GDPR.

Step 1 - Disable cookies by default

Go to your Matomo Configuration Variable and check the setting named "Require cookie consent" - this setting will disable all cookies by default, but still allow cookie less tracking.

Step 2 - Set up the CookieHub tag and enable automatic consents

For a simplified Matomo implementation, use our automatic consent feature. This feature tells Matomo whether it can set cookies based on the Analytics Consent from CookieHub.

It simply listens to the analytics consent in CookieHub and executes the commando below as soon as you have a consent to set Cookies for Analytics.


Of course a similar event exist for the whit drawl of the analytics consent.



You now have basic consent management synced with CookieHub in place. 

Advanced: Implementing CookieHub in Digitalist's Matomo SaaS: A Step-by-Step Guide

Step 1 - Disable cookies by default

Go to your Matomo Configuration Variable and check the setting named "Require cookie consent" - this setting will disable all cookies by default, but still allow cookie less tracking.

Step 2. Set Up the CookieHub Tag

  • Navigate to TagManager and add the Tag named "CookieHub."
  • In the Tag configuration, insert your CookieHub code and select the region for loading CookieHub. We recommend choosing the EU to ensure compliance with GDPR by avoiding data sharing outside the EU.
  • Optionally, enable automatic consent management for Matomo, allowing it to set cookies if analytics consent is given (detailed instructions below).
  • Execute this Tag on all page views unless specific settings dictate otherwise.

Step 3 - Set Up the CookieHub Variable

To execute logic based on consent status, set up a variable that lists the current settings. The output may look like this: 

cookiehubNecessary=true; cookiehubAnalytics=false; cookiehubMarketing=true. 

Use this variable in a trigger to validate the current consent status. 

Note that this information is also available in local storage.


Step 4 - Set Up the CookieHub Trigger

This trigger will fire on the following events:

  • cookiehubChanged – whenever a consent status changes.
  • cookiehubInitialised – when CookieHub code loads (shortly after the page view event).

While debugging CookieHub, you’ll see these events. This trigger is optional and is only needed if you want to fire code directly after a consent change. Typically, a page view trigger combined with the CookieHubStatus variable suffices.

5 - Example usage Firing a Tag Based on CookieHub Consent Status

If you want to fire a marketing tag only if the user consents to marketing, follow these steps:

Let´s say you want to fire a Marketing Tag only if a user has answered yes on marketing consent. 

1. Add the CookieHubStatus Variable

If not already created, this variable will hold the consent values, such as

2. Create a Consent Validation Trigger

Create a trigger of your chosen type, usually a page view, and ensure the CookieHubStatus variable contains the string cookiehubMarketing=true. Name the trigger appropriately and add it to your tag.

3. Create a Custom HTML Tag

Create a custom HTML tag containing the script you want to execute, for example:


//My custom code...


Attach the previously created trigger to this tag.


Read more about how to maximize data collection with Matomo in this post

Want to use the CookieHub Tag?

Sign up for Matomo SaaS from Digitalist, this feature is included.

(You will need to sign up for Cookie hub separately)

from 2499 SEK / month

Calculate your Matomo costs

Kan man köra Matomo på Windows?
Absolut, men frågan är om det är det smartaste valet. Läs mer så förklarar vi.