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.