Why is my Unique Visitor Id in my site’s browser console not always the same as my cookie id in the real-time dashboard in Piwik Pro? What’s the logic ?
I can follow my navigation across website thanks to my unique ID visitor but when I return on my piwik dashboard I see another ID
Here’s an example situation that might explain the case:
You have those settings in place:
Not consenting visitor: session hash, no cookie
Consenting: session hash, cookie
Now visitor enters your website for the first time. First entry so they are yet to make a decision, but already first events (page view, consent form view, potentially others if you allow them to browse without making a decision) are sent. Because they didn’t yet make a decision, we create for them a random visitor ID value which is also then used for Cookie ID value in the tool, that’s the one you’ll see in the dashboard. Now, after some time, they give consent, this consent creates the _pk_id cookie that holds the value for cookie ID, but that cookie ID is randomly generated as we do not send any data back from tracker to visitor’s page. Because you use session hash, the visitor is recognized as the same person even though their cookie ID value is different now (if not for session hash, once they made a decision, the session would be split), but we keep in analytics the first one that appeared, that’s why the one in the Cookie ID on the page is different then the Cookie ID you see in the tool.