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

Fix for opt-out toggling on page load and incorrect default state #19879

Closed
KiwiKilian opened this issue Oct 18, 2022 · 6 comments · Fixed by #19915
Closed

Fix for opt-out toggling on page load and incorrect default state #19879

KiwiKilian opened this issue Oct 18, 2022 · 6 comments · Fixed by #19915
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@KiwiKilian
Copy link

KiwiKilian commented Oct 18, 2022

Expected Behavior

The opt-out checkbox should only change when clicked. The checkbox and text should display the actual current state of the users choosen settings.

  • If the cookie mtm_consent_removed is set, the opt-out text should state, the user has opted-out. The checkbox should not be checked and say: "You are currently opted out. Check this box to opt-in."
  • If there is no mtm_consent_removed cookie set, the checkbox should be checked and the text should say: "You are not opted out. Uncheck this box to opt-out."

Current Behavior

Everytime the page with the opt-out is loaded, the state of the opt-out is toggled. So if there is no mtm_consent_removed cookie set, it will be set. Meanwhile the checkbox and text displays the opposite of the cookie state. It seems like the JS is just toggling the state everytime.

Steps to Reproduce (for Bugs)

  1. Create a page that only inlcudes the tracking snippet and the opt-out snippet
  2. Simply reload the page multiple times

Context

We are trying to implement the cookieless, opt-in method. Therefore the tracking code has set the following options:

    _paq.push(["setDoNotTrack", true]);
    _paq.push(["disableCookies"]);
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);

No other cookies are set for the domain. There are results beeing tracked by this example page.

(The different single and double quote styles are actually generated by Matomo UI).

Your Environment

  • Matomo Version: 4.12.1 (previously also occured on 4.12.0)
  • PHP Version: 7.4.3
  • Server Operating System: Linux
  • Additionally installed plugins: CustomVariables
  • Browser: Chrome, Firefox
  • Operating System: macOS
@KiwiKilian KiwiKilian added the Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. label Oct 18, 2022
@Findus23 Findus23 added Bug For errors / faults / flaws / inconsistencies etc. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. labels Oct 18, 2022
@heurteph-ei
Copy link

@justinvelluppillai
Copy link
Contributor

@bx80 can you please take a look here and see if we need to promote this issue?

@bx80 bx80 self-assigned this Oct 27, 2022
@bx80 bx80 added this to the 4.12.3 milestone Oct 27, 2022
@justinvelluppillai justinvelluppillai modified the milestones: 4.12.3, 4.12.4 Oct 27, 2022
@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/global-optout-is-not-working-this-isuseroptedout-always-return-false/47834/6

@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/strange-opt-out-issues/48252/2

@elabuwa elabuwa changed the title Opt-Out toggles on every load Fix for opt-out toggling on page load and incorrect default state Nov 22, 2022
@KiwiKilian
Copy link
Author

Thank you very much for the fix. Everything is working fine now with 4.13.0! 🚀

@bx80
Copy link
Contributor

bx80 commented Dec 11, 2022

@KiwiKilian Appreciate your taking the time to confirm that the fix worked - always great to hear! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants