Matomo uses visitor identifiers and a temporary, privacy-enabled hash (config_id) to recognise visitors, determine whether a tracking request belongs to an existing visit, and identify returning visitors.

How Matomo recognises visitors depends on the identifiers available and how the Matomo Tracking API is implemented. This FAQ explains the different visitor identification methods, how they affect returning visitor recognition, and the limitations of tracking without cookies.

Visitor recognition in Matomo

Matomo uses visitor identifiers and, where applicable, a temporary (config_id) to recognise visitors.

  • If a User ID is set, Matomo first attempts to match an existing visit using the Visitor ID (log_visit.idvisitor). If no match is found, Matomo looks for a visit with a matching config_id (log_visit.config_id). This means fallback matching can include a visit with the same User ID or a visit without a User ID, provided its config_id matches. Read more about the log_visit database table.

  • When a Visitor ID is manually set in the Tracking API using &cid=, Matomo uses that ID to look for matching visits in log_visit.idvisitor. This normally prevents fallback matching using the config_id.

  • When trust_visitors_cookies is set to 1 and a Visitor ID is available from a tracking cookie, Matomo only looks for visits where log_visit.idvisitor matches that Visitor ID.

  • Otherwise, when a Visitor ID is available, Matomo first looks for visits where log_visit.idvisitor matches the Visitor ID. If no match is found, Matomo may look for visits where log_visit.config_id matches the config_id.

  • When no Visitor ID is available, Matomo attempts to recognise the visitor using log_visit.config_id.

When matching visits by Visitor ID, Matomo can search historical visits in the database without applying the configurable look-back period. When matching by config_id (log_visit.config_id), Matomo uses a limited look-back period. By default, this is 30 minutes, but it can be extended using window_look_back_for_visitor. Learn more.

If a visitor is found, Matomo associates the tracking request with that visitor, either by updating an existing visit or creating a new visit when appropriate. Read more about what Matomo considers a visit.

What is the config_id?

Matomo generates a temporary, privacy-enabled hash (config_id) using a limited set of visitor settings and attributes, such as their operating system, browser, IP address, and browser language. This allows Matomo to attempt to recognise visitors without relying solely on tracking cookies.

The config_id is stored in the database and can be used to match tracking requests to previous visits. Learn how the config_id is processed.

Visitor recognition with other trackers

The Matomo JavaScript tracker normally manages visitor identification using tracking cookies.

If you use another tracker, such as the PHP tracker or tracking within a mobile app, you should send a consistent visitor identifier using the _id, cid, or uid tracking API parameter.

Depending on your implementation, you may need to store and reuse the visitor identifier in subsequent tracking requests. The _id and cid parameters identify visitors, while uid identifies a known user, such as someone logged in to your website or application.

Note: Older Matomo tracking implementations may reference parameters such as _idts, _idvc, _viewts, and _ects. For current implementations, use the supported visitor identification parameters described above.

Returning visitor identification

Matomo identifies returning visitors based on whether it can recognise them from previous visits, using the visitor identification methods described above.

  • A visitor may be classified as a returning visitor when Matomo can associate their current visit with a previous visit, either through a consistent visitor identifier or by matching their config_id.
  • When tracking cookies are unavailable, extending the window_look_back_for_visitor may help Matomo recognise visitors over a longer period within the same day since the config_id changes daily (by default).
  • Matomo can also classify a visitor as a Returning customer when it detects ecommerce order activity associated with the visitor. This classification can be triggered by a previously recorded order (according to the ‘last ecommerce order date’ found in tracking cookie and sent to Tracking API as &_ects=) or an ecommerce order placed during the current visit, even if the visitor has not been recognised from an earlier visit.

Cookieless Tracking

Matomo provides a global setting Force tracking without cookies that disables tracking cookies across all tracked websites. This option can be configured in Matomo under Administration admin gear icon > Privacy > Anonymize Data.

If you want to use a strategy where some visitors are tracked with cookies and others without, you can use a consent manager such as Cookiebot or Tarte au Citron. A consent manager can control whether Matomo uses tracking cookies. See the Matomo consent manager integration guides.

Visitor recognition look-back periods

When Matomo cannot identify a visitor using a Visitor ID, it may attempt to recognise them using their config_id.

By default, Matomo looks back 30 minutes when matching visitors by config_id. This period is based on the standard visit length and can be extended using window_look_back_for_visitor to recognise visitors over a longer period within the same day.

  • Matomo Cloud: The default is set by Matomo and cannot be changed as increasing the look back limit is computationally expensive: each visit may force Matomo to query hundreds of thousands of rows in the database.

  • Matomo On-Premise: This setting can be configured in the config.ini.php file. Increasing the look back period may improve returning visitor recognition when cookies are unavailable, but it can also increase database query costs, particularly on websites with high traffic volumes. Visitor ID matching is not restricted by this configurable look-back period.

Impact of cookieless tracking

Some data will be impacted for a visit that is tracked without a cookie. In particular, Matomo may be less accurate at recognising visitors across separate visits when a persistent visitor identifier is unavailable.

Visitor tracking across multiple domains

By default, Matomo does not track unique visitors across domain names. If you track multiple domain names in the same website in Matomo, and want to track your visitors accurately across all the domains, you can use Cross Domain linking.

Previous FAQ: How do I add a JavaScript heartbeat timer to measure time spent on page, including the last page of their visit?