Feature request: improve documentation on reading user consent state #17169
Labels
c: APIs
For bugs and features in the Matomo HTTP and plugin APIs.
c: Documentation
For issues related to in-app product help messages, or to the Matomo knowledge base.
c: Privacy
For issues that impact or improve the privacy.
c: Tracking
For issues related to getting tracking data into Matomo.
Enhancement
For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone
The guide at https://developer.matomo.org/guides/tracking-consent shows how to set and forget the user consent settings, but step 2 (asking for consent through your privacy notice) doesn't go into much detail on how to read the consent settings; the linked article in that section is more about the wording of the notice than implementation details.
Specifically, if we imagine the user's consent as having three states:
granted
,denied
, orundefined
(the default state), and we only want to display the privacy notice if it is set toundefined
, the documentation is very light on details there.I assume some combination of
hasRememberedConsent()
andgetRememberedConsent()
will do the trick, but it's not really clear how to get from that to "user has definitely given consent", "user has definitely refused consent", or "user has not answered either way".It doesn't help that typing either of those function names into the documentation search box returns no results — the only thing about consent is the page at https://developer.matomo.org/guides/tracking-consent which doesn't document the specific calls in any great detail.
Specifically, it does not find https://developer.matomo.org/api-reference/tracking-javascript#managing-consent, which gives a bit more detail, but is still unclear on how to tell the difference between "user refused consent" and "user has not answered the question yet".
(If the documentation already exists, it's a bit pointless if the search can't find it 😁 )
The documentation should really make it clear how to tell the difference so developers under time pressure don't simply implement it as "if user has not consented, display the consent dialog until they do", which is not the sort of behaviour that should be encouraged…
Ideally,
getRememberedConsent()
would return the time the question was answered, regardless of whether consent was granted or denied, so a truthy value would indicate the question has been answered. But that would probably be a breaking change now.By the way, I did look at https://developer.matomo.org/guides/core-team-workflow#submitting-a-feature-request per the contributing guidelines, but many of the links in there point to piwik.org and are now dead…
The text was updated successfully, but these errors were encountered: