piwik/piwik — pull request #6838 by jantlwoomy (2014-12-10 09:39:58+00:00)
Title: Store visitorID related to userID to cookies

When visitor is logging in and we are calling setUserID method, cookie value for uuid should be updated to this userID.

##### How it was before the fix:
1. Visitor enters the site, new random is visitorID generated.
2. Visitor registers on the site. We call setUserID and PiwikTracker.php generates new visitorID related to visitors userID.
3. Cookie visitorID is still random and **differs** from php visitorID.
4. Visitor logs out, all his actions are stored with cookie visitorID value. We **cannot** tell what visitor does after logging out.

##### How it is after the fix:
1. Visitor enters the site, new random is visitorID generated.
2. Visitor registers on the site. We call setUserID and PiwikTracker.php generates new visitorID related to visitors userID.
3. Cookie visitorID is the **same** as php visitorID.
4. Visitor logs out, all his actions are stored with cookie visitorID value. Now we **can** tell what visitor does after logging out.

This case scenario works only if trust_visitors_cookies option is true.