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

Error Message "There was an error setting cookie mtm_consent_removed. Please check domain and path" on every page load, when requireConsent option is set #19488

Closed
Constantin-Init opened this issue Jul 7, 2022 · 2 comments · Fixed by #19491
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone

Comments

@Constantin-Init
Copy link

Constantin-Init commented Jul 7, 2022

When the requireConsent option is set, every page load logs the error message "There was an error setting cookie mtm_consent_removed. Please check domain and path" to the console.

Reason seems to be that during creation of a Tracker forgetConsentGiven is being called, which then calls setCookie(CONSENT_REMOVED_COOKIE_NAME, ...). setCookie sets the cookie properly, but wants to check that it is indeed set with a call to get getCookie, which then fails, because configCookiesDisabled is set to true at this point, and the function returns 0

Fix would be make the behavior of getCookie and setCookie in regards to the CONSENT_REMOVED_COOKIE_NAME and configCookiesDisabled the same.
The change to setCookie was introduced here 9e10a15

@sgiehl
Copy link
Member

sgiehl commented Jul 7, 2022

Hi @Constantin-Init
Thanks for creating this issue. Guess this should be easily fixed by doing the same check in getCookie as well.
I'll put up a PR to fix that.

@sgiehl sgiehl added Needs Review PRs that need a code review Bug For errors / faults / flaws / inconsistencies etc. and removed Needs Review PRs that need a code review labels Jul 7, 2022
@sgiehl sgiehl added this to the 4.12.0 milestone Jul 7, 2022
@sgiehl sgiehl self-assigned this Jul 7, 2022
@justinvelluppillai justinvelluppillai added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Sep 29, 2022
@ghnp5
Copy link

ghnp5 commented Jul 30, 2023

I noticed I was getting this on every page load, for both "mtm_consent" and "mtm_cookie_consent".

The cookies seemed to be already set, but for some reason, Matomo was failing to set them.

Then I removed the cookies manually (through DevTools) and the issue went away.

I wonder if some Matomo update changed something with the cookies, and the existing cookies were somehow conflicting with the latest Matomo version, that it tried to set them again, but failing.

Now it will be hard to debug, since it's no longer happening to me. But just wanted to put the comment here, in case it brings some lights to you.

Thank you!

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. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants