Matomo: Associating Requests with User IDs

This documentation is part of the Getting Started guide. You can view the complete guide here: Learn how to efficiently set up and use Matomo for your analytics needs..

👋 Welcome to the Stackhero documentation!

Stackhero offers a Matomo cloud solution that simplifies web analytics:

  • Unlimited websites, members, segments, goals, and data retention: analyze everything you need, for as long as you need it.
  • Effortless updates: keep your analytics platform up to date with just one click.
  • Custom domain name with HTTPS: run Matomo on a secure, branded URL, for example https://analytics.your-company.com.
  • High performance and enhanced security: your data is hosted on private, dedicated infrastructure to ensure reliability and confidentiality.

With Stackhero, you can deploy Matomo analytics in just a few minutes and manage all your sites from a single location. Try our Matomo cloud hosting to simplify your analytics and focus on what matters most.

Enhance user tracking by associating requests with a user ID in Matomo. This step can help you gain deeper insights into user behaviour.

To set this up, define the user ID using the _paq.push([ "setUserId", "<userIdHere>" ]); code.

Keep in mind:

  • setUserId must be defined before trackPageView.
  • The User ID must be a string. Although Matomo will not log an error if you send integers, it will not display the corresponding user ID. Use userId.toString() if you need to convert an integer to a string.

For more details, refer to Matomo's JavaScript Tracking Guide.

Ensure compliance with relevant laws when associating user IDs with requests.