User ID tracking requirements and data collection
User ID tracking can be enabled in using the Matomo JavaScript tracking code, Tag Manager, WordPress, or Matomo SDKs. Before enabling tracking, it’s important to understand how User IDs are generated and connect with Matomo tracking, and what data will be collected.
This guide explains the requirements and identification strategy to consider before implementing User ID tracking in Matomo.
Requirements to enable User ID tracking
User ID tracking relies on your own website authentication system to assign a stable identifier to each logged-in user. Matomo then uses the identifier to link visits, actions, and conversions from the same person across multiple devices or sessions.
-
Consent and privacy
If your organisation operates in a region governed by privacy laws such as the GDPR, ePrivacy Directive, CCPA, or similar frameworks, ensure that consent explicitly covers the collection of analytics data. Read more about User ID and privacy considerations. -
Login or account system
Your website or app must already handle user registration, authentication, and login as Matomo does not create or manage user accounts. -
Stable, non-personal identifier
Each account should have a persistent value such as a numeric ID, username or email address and use the same value across all platforms (for example, web and mobile) to allow cross-device analysis. However, when using a username or email or other personal identifier, it is recommended to update your Matomo privacy settings to use a pseudonym to replace the User ID for enhanced privacy. The User ID pseudonym is processed using a salted hash function. -
Tracking integration
The User ID must be passed to Matomo either through the JavaScript tracker, Matomo Tag Manager, Tracking API, or Matomo SDK.
Data collection and reporting
User IDs originate from your authentication or account management system. Each time a user signs in, the backend assigns their unique identifier and passes it to Matomo. Matomo stores every action (such as session metadata, page views, events, goals, or purchases) together with that User ID. All visits that include the same User ID are linked, even if they occur on different devices or browsers. When the user logs out, your system stops sending the User ID and Matomo records new activity as anonymous until the next login.
Next steps
Start with implementing User ID tracking in your environment to analyse logged-in user behaviour. The setup process varies depending on how Matomo is integrated with your website or app. Read the step-by-step set up guides on how to track User IDs with the Matomo JavaScript tracking code, Manager Tag Manager, WordPress, or SDKs.
You can explore the data in the Visitors reports for User ID, Visitor Profile and Visits Log and use Segments to compare how logged-in users interact across sessions.