Matomo: Associating requests with user IDs
This documentation is part of the Getting started guide. You can view the complete guide here: Discover how to efficiently set up and utilise Matomo for your analytics requirements..
👋 Welcome to the Stackhero documentation!
Stackhero offers a Matomo cloud solution that simplifies web analytics:
- Unlimited websites, members, segments, goals, and data retention: analyse everything you need, for as long as you require.
- Effortless updates: keep your analytics platform up to date with a single click.
- Custom domain name with HTTPS: run Matomo at a secure, branded URL, such as 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:
setUserIdmust be defined beforetrackPageView.- 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.