If I add another tracker, then after each page reload the Unique User ID (
_pk_id) value is reset when using
If only one tracker is registered, the Unique User ID remains stored.
As a result, Matomo no longer tracks users across multiple visits.
See live example: https://www.erf.de/test.html
ping @sgiehl, this happens when
setCookieConsentGiven are set, as described the
_pk_id will change, but not sure is a bug or expected.
I'm unfortunately not very familiar with how this is supposed to work. I can imagine that this might be expected. If each tracker tries to set his own cookie, they might overwrite each other.
Maybe @tsteur is able to say if that is supposed to work. If so the product team needs to decide when we should investigate and fix that.
Since they are different Matomo's I don't think it's not quite expected that they overwrite each other but there is also maybe no easy fix to it without breaking anything.
A workaround could be to configure one tracker differently using
setCookieNamePrefix? so it doesn't use
_pk_ as the prefix but a different and thus it won't overwrite the cookie? Potentially this be a use case to document?
I didn't look too deep into it though.