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
wrong value returned by getVisitorId() #2643
Comments
The cookies are not compatible with each other, plus the third-party cookie can also be named differently (via cookie_name). |
Replying to vipsoft:
|
piwik.js uses a first-party, client-side generated cookie. It doesn't understand the format of the third-party, server-side generated cookie. |
Ok, thanks I got it, so it's a normal behaviour then: I thought that getVisitorId() was making an Ajax call, instead of just reading first-party cookie. |
No, retrieving the visitor ID by AJAX isn't possible, and I'm not sure if it's planned given the security considerations and bulk loading contemplated in #134. |
Hmm, ok. Now that I think about it, I suppose it is always possible to select recent rows inside piwik_log_visit table, and then filter by IP to retrieve idvisitor value with more or less success... Anyway thanks for the explanations and a prompt response. |
Just to clarify the default use case (no 3rd party cookies): When you refresh the page with no cookie, Piwik will generate a new visitor ID on the client side (1st party cookie), since you don't have any cookie. Then it will send this cookie value to the server and the log_visit row for this visit should be updated with the newly created idvisitor. |
It's still valid in 2.3.0 So never use "use_third_party_id_cookie" setting, when u are tracking also in your backend (e.g. PHP) Otherwise your user will be counted twice. Solution / Idea?
|
Steps to reproduce:
The call to getVisitorId returns the value stored inside the newly created cookie (= the _id GET parameter in the call to piwik.php), instead of the idvisitor determined from the config and saved in the piwik_log_visit table.
In my config I have:
tracker_always_new_cookie = 0
use_third_party_id_cookie = 1
trust_visitors_cookies = 0
The text was updated successfully, but these errors were encountered: