Skip to content

Console error "There was an error setting cookie mtm_cookie_consent. Please check domain and path." when calling 'rememberCookieConsentGiven' #17926

@McSodbrenner

Description

@McSodbrenner

I get the error "There was an error setting cookie mtm_cookie_consent. Please check domain and path." on every page load in my Chrome browser.
I was able to narrow it down to this location in the minified matomo.js:

                if ((!dt || dt >= 0) && aD(dp) !== dq) {
                    var dk = "There was an error setting cookie `" + dp + "`. Please check domain and path.";
                    ak(dk)
                }

The problem is the second part of the condition. aD(dp) !== dq is indeed unequal, but only because the type is not correct. The first part returns 1630087076907 as a string, while the second part returns the same 1630087076907 as an integer.

Expected Behavior

No console error should be thrown.

Possible Solution

A typecasting would have to take place before (or a != would have to be set instead of a !==).

Steps to Reproduce (for Bugs)

I don't know why others don't see the error message. I can reproduce the error locally and on prod.

Your Environment

  • Matomo Version: 4.4.1
  • PHP Version: 7.2.23
  • Browser: Chrome 92
  • Operating System: Windows 10

Metadata

Metadata

Labels

BugFor errors / faults / flaws / inconsistencies etc.RegressionIndicates a feature used to work in a certain way but it no longer does even though it should.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions