PageSpeed Insights error: There was an error setting cookie `_pk_id.1.5495`


I’m using the Matomo version 4.12.3. with Joomla! 3.10.11.

In PageSpeed Insights I get the following console error shown under “Best Practices”:

There was an error setting cookie _pk_id.1.5495. Please check domain and path. (/stats/matomo.js:12:281)

If I activate the option “Force tracking without cookies” in the matomo admin panel, the error in PageSpeed Insights disappears.

Also this error is not visible in the browsers’ developers console, only “PageSpeed Insights” notices it.

Is there any solution (besides disabling cookie-tracking) to avoid this?