Closed osca closed 6 months ago
Hi @osca
Do you want to implement opt-in or opt-out?
For opt-in: your configuration seems correct, but you must then use methods like isConsentGiven()
or setConsentGiven
instead.
For opt-out: your configuration must be changed to requireConsent: MatomoConsentMode.NONE
(or empty), and then use methods you described (isUserOptedOut()
, optUserOut()
...)
Thanks for the fast answer. I changed the requireConsent
to MatomoConsentMode.NONE
, but still no response from the methods. I created a small sample project to reproduce it:
Is there maybe something wrong with my Matomo config?
@osca Sorry I missed an important information: MatomoTracker
was not originally designed to work with Tag manager. So the methods available on it may not work properly.
The only workaround I see right now to use both tag manager and tracker methods, is to include the standard tracker script (matomo.js) using this lib configuration options, and include tag manager script (https://${matomoHost}/js/container_${containerId}.js
) manually in your page.
To wait for user to consent for cookies/tracking, you can delay the call to window._mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
. If you are using a Consent Manager it probably provide integration with Matomo Tag Manager.
I'm setting up Matomo Tag Manager as provided in the documentation with the resulting provider:
When trying to create a custom opt-out form, I want to get the current state of the tracking via
matomoTracker.isUserOptedOut()
. This Promise does not return anything and seems to be just stuck. No error, no response in the console. AlsomatomoTracker.forgetUserOptOut()
andmatomoTracker.optUserOut()
seems to do nothing. Do I need some special configuration to get this working properly? Thanks for any help in advance!