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 ready-to-use Matomo cloud solution that provides a host of benefits, including:

  • Unlimited websites, members, segments, goals, and data retention time.
  • Effortless updates with just a click.
  • Customizable domain name secured with HTTPS (for example, https://analytics.your-company.com).
  • Optimal performance and robust security powered by a private and dedicated VM.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's Matomo cloud hosting solution!

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.