Skip to content

Accurate User Detection cross devices: User ID (set in JS and all other clients) #3490

@mattab

Description

@mattab

The goal of this ticket is to allow tracking of unique visitors across devices via the use of a User ID. This is similar to Universal Analytics User ID feature.

Tasks:

  • add new &uid parameter to the tracking API.
    • this parameter can be set to any string. The string will be hashed, and used as "User ID".
    • this is almost the same as &cid= except cid must be a 16 characters hex string.
      • &uid can be set to any string and Tracking API will take care of hashing it.
    • should we store both the hash, and also the raw User ID?
  • add new setUserId() javascript tracking function
  • add new setUserId() PHP client tracking function
  • Add custom segment userId to select only actions by this User ID.

Use cases

Let's make it work at least in following use cases, and add an automated test for it.

  • User starts visit logged out. Then user logs in. The User ID is set.
  • User starts visit logged in. The user ID is set.
  • User starts visit logged in. The user ID is set. User logs out. User ID is not set.
  • Tracking API requests when both cid and uid are used -> which one is used?
  • When the User ID changes in the same session, create a new visit. + add test

Docs & FAQ

Todo:

Notes

  • Piwik has two User IDs currently:
    • idvisitor which is set to a random value, or the one found in the first party cookie (which was random UUID), see getVisitorIdcookie()
    • config_id which is a value that is not random, and is set to a of the user attributes (user agent, IP, etc), see getConfigHash()
  • See: Universal Analytics User ID
  • Later we could add
    • Setting to let Piwik admin disable this feature
    • "Cross Device report"

Once feature is done, notify Android SDK project to brief on API and make sure feature will be there.

Metadata

Metadata

Assignees

Labels

EnhancementFor new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.MajorIndicates the severity or impact or benefit of an issue is much higher than normal but not critical.c: PlatformFor Matomo platform changes that aren't impacting any of our APIs but improve the core itself.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions