-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Closed
Copy link
Labels
EnhancementFor new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.For 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.Indicates 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.For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.
Milestone
Description
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
uid
can be set by default on Tracking API requests- cid does not require token_auth by default (since &userId does not). see Tracker API: cid parameter no longer requires token_auth #6109
- 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:
- Add a FAQ for this feature "How do I specify the User ID (unique ID across devices) to increase accuracy of Unique Visitors reporting?"
- Also update the JS doc at: http://piwik.org/docs/javascript-tracking/
- And the reference at: http://piwik.org/docs/tracking-api/reference/
- Also integrate other related FAQs somewhere that makes sense eg. http://piwik.org/faq/how-to/faq_190/ http://piwik.org/faq/how-to/faq_175/ and related.
- Also we should note that "Unique Visitors" means in reality "Unique Devices" and maybe this could be mentionned in Column documentation + User docs. See forum post
- Resources & inspiration, Google Analytics doc,
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.For 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.Indicates 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.For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.