By default, Matomo uses an anonymous visitor ID cookie to recognise returning visitors. This cookie identifies the same person only when they return using the same device and browser. If the visitor clears cookies, uses a different browser, or switches devices, Matomo treats them as a new visitor. As a result, visits and actions from the same person can appear as separate records.

When User ID tracking is configured, Matomo can capture the unique identifier each time a user logs in to your website. The User ID links all visits and actions associated with that user across devices and browsers. Even if cookies are deleted, Matomo reconnects new visits to the same User ID once the person logs in again.

user id across devices

This creates a continuous, unified history of each identified user’s interactions, enabling more accurate analysis of engagement, conversions, and lifetime value.

When to implement User ID tracking

User ID tracking is useful for websites with authenticated users, subscription models, or customer accounts. It is particularly effective when visitors log in regularly, use multiple devices, or complete actions that need to be linked to the same account over time.

It helps with analysing logged-in user behaviour and measuring customer retention by combining visits and interactions under a single visitor profile. Learn more about the Benefits of User ID tracking.

How User IDs are tracked in Matomo

To track User IDs in Matomo, your website or app must already include an account management system that handles user logins and authentication. Matomo does not create or manage user accounts on another platform.

Instead, you will need to include the userId parameter in your tracking code or Matomo Tag Manager configuration variable. After a visitor logs in to your website or app, your system assigns the User ID and Matomo captures it with each tracking request.

Once tracking is active and reports have processed, view the Visitors > User IDs report:
view user id report

You can then use the Reporting API, create Segments based on User IDs, and include the User ID dimension to create Custom Reports.

User IDs and compliance

For privacy compliance (where applicable), identifiers should be anonymised or pseudonymised where necessary, and that tracking only occurs once the visitor has given valid consent.

In Matomo privacy settings, you can enable using pseudonyms instead of User IDs to avoid directly storing and displaying personal data. Learn more about User ID privacy considerations.

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.