User ID tracking in Matomo links visits, actions, and conversions to a single identifier so you can recognise the same user across sessions, devices, and browsers. The User ID setup and configuration depends on how Matomo is implemented: either through the JavaScript tracking code, Matomo Tag Manager, the WordPress plugin, or one of the Matomo SDKs.

This guide covers how to set up User ID tracking in Matomo for WordPress.

Before you start

  • You can set up the WordPress integration using the Matomo for WordPress plugin or the Connect Matomo plugin for Matomo Cloud or On-Premise. Tracking must be activated through the plugin settings.
  • You will need a unique and persistent user identifier that represents each logged-in user and access to your WordPress admin settings. WordPress users can typically change their email address, but not their username. When choosing a unique identifier, select Username if you want the most reliable identifier.
  • When using any personal identifier, it is recommended to update your Matomo privacy settings to use a pseudonym to replace the User ID for enhanced privacy. The User ID pseudonym is processed using a salted hash function.
  • If you operate in a region with privacy or consent requirements, ensure that implementing User IDs is compliant and covered under valid consent before implementing this setup.

Matomo for WordPress: Enable User ID tracking

  1. Log in to your WordPress dashboard with an admin account.
  2. Hover over Matomo Analytics in the menu and select Settings.
  3. Scroll down to the General Tracking Settings > Other Tracking section.
  4. Locate the Track WordPress User ID drop-down and select Username.
    track userid matomo for wordpress
  5. Click Save Changes.
  6. Read the Verify User ID tracking section below to test the setup.

Connect Matomo (WP-Matomo): Enable User ID tracking

  1. Log in to your WordPress dashboard with an admin account.
  2. Hover over Settings in the menu and select Connect Matomo.
  3. Click on the Enable Tracking tab and ensure the correct Add tracking code option is selected. If you manually define the tracking code, the User ID tracking setting will be unavailable.
    tracking for connect matomo plugin
  4. Scroll down to the User ID Tracking setting and select Username in the drop-down.
    select username for user id
  5. Click Save Changes.
  6. Read the section below to test the setup.

Verify User ID tracking

After adding the User ID to your tracking code, verify that data is being sent and received correctly.

  1. Open your website, log in as a user and reload the page.
  2. If you’re using Matomo for WordPress, go to Matomo Analytics > Reporting.
  3. If you’re using Connect Matomo, open Matomo and to to Visitors > Real-time and Visits Log.
  4. Your User ID should appear in the reports.
    view user id in visits log
  5. To test tracking anonymous sessions, log out of your website and reload the page.
  6. In Matomo, the visit should not appear under a User ID in the Visits Log and Visitor Profile.

Once User ID tracking is configured, you can measure customer engagement, compare logged-in and anonymous behaviour, and analyse user journeys across all Matomo reports. Use the Reporting API, create and analyse Segments, track conversions, and include the User ID dimension.

Previous FAQ: Set up User ID tracking with Matomo SDKs