Matomo: Associating requests with user IDs
This documentation is part of the Getting started guide. View the full guide here: Discover how to efficiently set up and utilize Matomo for your analytics requirements..
👋 Welcome to the Stackhero documentation!
Stackhero provides a Matomo cloud solution that streamlines web analytics:
- Unlimited websites, members, segments, goals, and data retention: track everything you need, for as long as you need it.
- Effortless updates: keep your analytics platform current 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 strong security: your data runs on private, dedicated infrastructure for reliability and privacy.
With Stackhero, you can launch Matomo analytics in minutes and manage all your sites from one place. Try our Matomo cloud hosting to simplify analytics and focus on what matters.
Enhance user tracking by associating requests with a user ID in Matomo. This step can help you gain deeper insights into user behavior.
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.