Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to ask for consent for Matomo data collection using a Consent Manager #15511

mattab opened this issue Feb 4, 2020 · 9 comments
c: Documentation Indicates a need for improvements or additions to documentation. c: Onboarding For issues that make the experience of getting Matomo up and running better. c: Privacy For issues that impact or improve the privacy. Help wanted Beginner friendly issues


Copy link

mattab commented Feb 4, 2020

The goal of this issue would be to research and document how to use one or more existing Consent Managers tools with Matomo. Currently we only offer a JavaScript-level solution to help implement asking for consent, but it is only basic and technical. From users point of view, it would be great to read one or several user guides explaining how to setup a Consent Manager and ask consent for Matomo data collection.

Why is this important?

In the context of the GDPR privacy regulations, when you are processing personal data, in some cases you will need to ask for your users' consent. To identify whether you need to ask for consent, you need to determine whether your lawful basis for processing personal data is "Consent" or "Legitimate interest", or whether you can avoid collecting personal data altogether.

Consent managers tools

There are quite a few tools out there, for example:


might also need #13056

@mattab mattab added c: Privacy For issues that impact or improve the privacy. c: Documentation Indicates a need for improvements or additions to documentation. labels Feb 4, 2020
Copy link

For universal compatiblity in WordPress, I would recommend to integrate with the WP Consent API.

This is essentially a framework to standardize communication between plugins that manage consent, and plugins that place cookies/track data/statistics in any way. For more detailed info, please checkout the readme on git. I'll briefly explain it below.

It will be released on WordPress as a separate plugin (currently awaiting plugin review), and is expected to get merged into core eventually. Currently Cookiebot, WPMU Dev are actively integrating, we're still talking with other plugins like CAOS, Advanced Ads, etc. Of course, it will really gain traction when it has a lot of installs, but to get there we're actively looking for plugins to help us get there.

The way we have implemented it in Complianz GDPR, is that, if we detect a plugin supports it, we fire the "recommended plugin" installer.

In the case of Matomo in combination with Complianz GDPR, it would work as follows:

  • A visitor from the Netherlands visits the website. Complianz GDPR sets the consent level to 'allow' for functional and statistics-anonymous

  • A visitor from the UK visits the website. Complianz GDPR sets the consent level to 'allow' for functional, as it is not allowed to track visitors anonymously in the UK.

  • A visitor from the US visits the website. Because Complianz GDPR has set the consent type to 'opt-out', all consent levels will return true by default.

  • Let's say the site admin has configured Matomo to anonymously track statistics. Because of this setup, Matomo can check the consent for the category 'statistics-anonymous'. For the Netherlands and the US, this will return true immediately. For the UK it will return false until the user has consented explicitly.

When statistics-anonymous returns a true, Matomo can start tracking hits.

If the site admin has configured Matomo to track not anonymously, the consent level that should be checked is 'statistics'.

The consent API has been built to be used both in javascript and in PHP. We've added hooks that can be used to fire the javascript as soon as consent is given, without page reload. A simple example can be found here:

Using the Consent API is the only way to get WordPress plugins to work together in a reliable way. As it stands, you have to build separate integrations for each consent management plugin (in your case), or in our case, as consent management plugin, build an integration for each data tracking plugin (which is actually what we're doing right now). But even then, we can't prevent plugins from placing PHP cookies, so we can't cover everything 100%. The Consent API

Please let me know if you have any questions about this. Would be great to have you on board!

Copy link

tsteur commented Feb 6, 2020

This is interesting @rlankhorst . Thanks for that. I reckon this could make quite some sense to support it if possible since many compliance tools likely naturally support WordPress maybe. To be looked into though.

Also maybe someone already made that work for us (eg wrote a plugin for complianz etc) so there might be not even much to do. To be checked though.

@mattab mattab added this to the 4.3.0 milestone Jul 1, 2020
Copy link
Member Author

mattab commented Jul 1, 2020

Assigning tentatively to 4.3.0. It would be valuable to offer documentation on how to integrate consent managers within Matomo. We'd publish the content on our website. Ideally we'd cover the main tools (and research/signup if they offer affiliate/reseller programs).

Copy link

@mattab I don't think the WP Consent API is what you call a consent manager: it's nothing more than WordPress standard which allows a plugin which places cookies to communicate with a cookie banner plugin through a standardized interface.

In the case of Matomo, the Matomo WordPress plugin can integrate with the WP Consent API to check if a user has given consent for anonymous statistics or statistics. The advantage for everyone here is that Cookie Banner plugins like Complianz GDPR/CCPA and Cookiebot only have to tell the WP Consent API that consent is given for anonymous statistics/statistics, and Matomo only has to check the WP Consent API, as opposed to building separate integrations for each Cookie Banner plugin separately. In Complianz we currently have ship 60 integrations with plugins and services. The WP Consent API would make this list not necessary anymore.

The WP Consent API is probably going to be added as feature plugin with WordPress 5.6, to be added to core after that.

@tsteur tsteur added the Help wanted Beginner friendly issues label Jul 27, 2021
Copy link

@mattab We can maybe update the issue to link to this guide for Cookiebot:
It's for setting up consent with Matomo Tag Manager instead of with GTM

@tsteur tsteur added the c: Onboarding For issues that make the experience of getting Matomo up and running better. label Jul 5, 2022
Copy link

atom-box commented Sep 8, 2022

This user likes Complianz

we find in Complianz Plugin a simple integration on Matomo Analytics service for cookie consent.
In the wizard it asks for matomo server and ID to settle and it's done. Very useful.

Copy link

adiladvani97 commented Mar 13, 2023

Here are some popular consent management tools for WordPress:

Securiti: A GDPR and ePrivacy-compliant cookie consent management tool that provides a comprehensive solution for WordPress websites. It scans your site for cookies and creates a cookie declaration that informs your visitors about the types of cookies you use.

Lightweight Cookie Notice: A free plugin that provides a customizable cookie consent banner to your WordPress website. It is fully compliant with GDPR and ePrivacy laws and allows visitors to opt-in or opt-out of cookies.

MT Cookie Consent: A plugin that provides a comprehensive cookie consent solution for WordPress websites. It creates a cookie policy and a cookie banner that complies with GDPR, CCPA, and other privacy regulations.

Cookie Accept: A popular and free plugin that displays a cookie consent banner on your WordPress website. It allows visitors to accept or decline cookies and also includes an option to read your cookie policy.

Privado’s GDPR Cookie Consent: A plugin that provides a variety of features to make your WordPress website compliant with GDPR. It includes a cookie consent banner and also allows you to delete user data, generate privacy policy, and more.

Borlabs Cookie: A plugin that provides a customizable cookie consent banner for your WordPress website. It also includes options to block specific cookies and scripts until visitors give their consent.

These are just a few of the popular consent management tools available for WordPress websites. It's important to choose a tool that fits your specific needs and complies with the relevant privacy regulations.

Copy link

Providing consent for Matomo data collection is an important step in protecting user privacy. You can ask for consent by leveraging a Consent Manager. There are many plugins and solutions available that allow you to easily implement cookie consent for Matomo. Some of the popular ones include Securiti, Cookie Consent by Insites, and Cookie Consent Manager. These plugins allow you to easily customize the way you ask for consent and also keep track of user consent. These solutions are great for ensuring that you are compliant with data privacy regulations.

Copy link

Hi @mattab
I think some documentation about onetrust could be a plus, as I think this is the one I see the most in Matomo forums...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
c: Documentation Indicates a need for improvements or additions to documentation. c: Onboarding For issues that make the experience of getting Matomo up and running better. c: Privacy For issues that impact or improve the privacy. Help wanted Beginner friendly issues
None yet

No branches or pull requests

7 participants