Allow tracking user cookie consent using Matomo API

Created on 8 March 2023, over 1 year ago
Updated 9 March 2023, over 1 year ago

Problem/Motivation

As of now, the only exposed option is to enable (default) or disable cookie tracking.

          if (drupalSettings.matomo.disableCookies) {
            _paq.push(['disableCookies']);
          }

Nevertheless, Matomo provides an alternative way which seems to be more adapt to cookie banners / consent as it will initiate matomo on a "hold" status (pending user approval of cookies) and can be updated accordingly.

Here is the info , it should be implemented as this:

// Require user cookie consent before storing and using any cookies
_paq.push(['requireCookieConsent']);

And when using your preferred consent tool (EU Cookie Compliance module, GTM, custom) and consent is given, it should be updated like this:

_paq.push(['rememberCookieConsentGiven']);
_paq.push(['forgetCookieConsentGiven']);

Proposed resolution

Allow a new option called "Initiate on require cookie consent mode", it will insert the "requireCookieConsent".

This option can't be active at the same time as "Disable cookies".

The "rememberCookieConsentGiven" part needs to be implemented by the developer on its preferred consent tracking tool.

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024