when calling JS API piwikTracker.getVisitorId() early (before the trackPageView() call) the returned ID will be a random one, not actually used by Piwik later. Instead, loadVisitorCookie should set the cookie when it's not already set.
(In ) Fixes #2315 and updating tests (starting to love these JS tests ;)
The code should only persist uuid (in a variable).
The current code fails for a new visitor when you call getVisitorId() and then trackPageView() because the saved cookie will incorrectly be treated as a return visitor.