Piwik tries to guess visitors and unique visitors using several elaborate techniques (first party UUID cookie, heuristics matching user settings, etc.). If several people use the same system or browser, Piwik might count them all at one visitor. Sometimes, a system makes it easy to know when this is the same person or not. For example some system ask users to login every time, so we know when a new user connects. If you are in the use case of multiple people using the same computer or website or app, then you could improve your unique visitor detection by trigger a new visit to Piwik every time the user logs in the system.
To create a new visit you can use the &new_visit=1 parameter in the Tracking API (see Reference docs).
_paq.push(['appendToTrackingUrl', 'new_visit=1']); // (1) forces a new visit _paq.push(["deleteCookies"]); // (2) deletes existing tracking cookies to start the new visit // the two lines must be above the call to track* function _paq.push(["trackPageView"]);
When the page loads, a new visit will be created in Piwik. Note: this code should only be displayed once after the user logged in; if you leave this code in all the page views, it would create a new visit for each page view and make your Piwik reports much less useful.