@wlabarron opened this Issue on November 10th 2020

Summary

I've previously implemented a custom consent form which I use on my Matomo-enabled websites.

If a user opts-in to tracking, it calls _paq.push(['rememberConsentGiven']);. If a user opts-out, it calls _paq.push(['forgetConsentGiven']);. Matomo then set the mtm_consent and mtm_consent_removed cookies respectively. If either of those cookies were set, I knew the user had made a consent decision, so the opt-in message wasn't shown to the user again.

At some point recently, it seems the behaviour of _paq.push(['forgetConsentGiven']); has changed.

Previous behaviour

  • _paq.push(['forgetConsentGiven']); sets the mtm_consent_removed cookie and unsets the mtm_consent cookie.

Currently-observed behaviour

  • If mtm_consent is not set, _paq.push(['forgetConsentGiven']); has no effect.
  • If mtm_consent is set, _paq.push(['forgetConsentGiven']); unsets it and sets mtm_consent_removed.

Question

Is this an intentional Matomo API change? I can't find it in any changelogs or documentation.

Thank you!

@tsteur commented on November 10th 2020 Member

Hi @wlabarron

The method should

  1. Unset / remove any possibly set mtm_consent cookie
  2. Set the mtm_consent_removed cookie.

It should do this no matter if mtm_consent is set or not set see https://github.com/matomo-org/matomo/blob/3.14.0/js/piwik.js#L7815-L7818

If mtm_consent is not set, _paq.push(['forgetConsentGiven']); has no effect.

It is possible that in this case the cookies are disabled and therefore the call to set the mtm_consent_removed cookie doesn't work. If that's the case, we fixed this already in Matomo 4 (which will be released in 1-2 weeks) and also backported this yesterday to our 3.X branch so it will be included in the next release (not sure when the next 3.X release will be) https://github.com/matomo-org/matomo/pull/16668/files

@wlabarron commented on November 10th 2020

Hey @tsteur, thank you for your response. I've just been testing it on my browser, calling the two methods in the console, and that's the behaviour I've noticed. Cookies are enabled, as far as I know -- I've got requireConsent in my initial Matomo script, but I've not called disableCookies. Is there another way they can be disabled?

@tsteur commented on November 10th 2020 Member

requireConsent can disable cookies directly. So that's likely what's happening and the next release should fix this already.

@wlabarron commented on November 11th 2020

Ah, I see. I've just updated to Matomo 4.0.0-rc2, and can confirm that this issue is fixed.

Thank you for your help!

@tsteur commented on November 11th 2020 Member

Great, thanks for confirming @wlabarron

This Issue was closed on November 11th 2020
Powered by GitHub Issue Mirror