Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom consent form behaviour change? #16693

Closed
wlabarron opened this issue Nov 10, 2020 · 5 comments
Closed

Custom consent form behaviour change? #16693

wlabarron opened this issue Nov 10, 2020 · 5 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@wlabarron
Copy link

wlabarron commented Nov 10, 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
Copy link
Member

tsteur commented Nov 10, 2020

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
Copy link
Author

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
Copy link
Member

tsteur commented Nov 10, 2020

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

@wlabarron
Copy link
Author

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 tsteur added the answered For when a question was asked and we referred to forum or answered it. label Nov 11, 2020
@tsteur
Copy link
Member

tsteur commented Nov 11, 2020

Great, thanks for confirming @wlabarron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants