Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
mattab opened this Issue · 23 comments

4 participants

@mattab
Owner

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 #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:

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.

@anonymous-piwik-user

Or instead, can we just set a custom request in the JavaScript?

For example:

piwikTracker.setExtraRequest({
    visitor_id: 'your id',
    additional_data: { /*......*/ }
});

In this case, we can capture as many parameters in the plugins as we can.

@mattab
Owner

Cheers @tsteur for the ping

@hpvd

I'm not sure about the way how to do it best.
Should we really set/change the visitor ID for cross device detection if the user "gets a name" (e.g. by logging in)?

Maybe another way is to generated a new additional "User-ID" to which we could add all Visitor IDs.

so we have a structure like that:

User-ID

  • Visitor-ID (the same user on his desktop @ home)
  • Visitor-ID (the same user on his desktop @ work)
  • Visitor-ID (the same user on his tablet)
  • Visitor-ID (the same user on his smart phone)
  • ...

Doing it that way we could keep all details of "who is who" within piwik and the plugins of forums, shops etc (see ticket #3622) only have to submit on each login to piwik the pear of visitor ID and the account/mail/name.

@hpvd

and another thing we should take care for:

  • what happens if you track a user within one piwik installation on two different websites where each have a login (identify) possibility where the user uses different user names?

  • what happen if the user visit several websites with login which uses all piwik...

@anonymous-piwik-user

this is an almost impossible task. one would have to be truly accurate need to implement a method like comscores total universe reporting. whereby an individual is given a panel box and required to each time they logon verify id then users behaviour is assigned to that profile.

in assigning a user id to a machine one can lose site of what happens if one user logs in then someone else starts to use the machine?

the simplest solution though not 100% accurate is like in a paywell environment. a user is given a login and password. one can then assign a unique string then cross refrence it against device type or user agennt.

again limitation is user needs to login. you will have your site of those logged in vs non logged in. hope the sample ratio is enough to give you desired metrics to make informed decisions. one other thing there can also be a privacy issue when one starts to collect user data.(see googles new ad impression user data collection privacy policies)

i see the goal mentioned above but i have to ask what does this goal accomplish? what is the end result desired with the data mined from this? i think determining what this data will provide from an insights perspective should help direct this ticket.

@mattab
Owner

See also #2211 piwik.js: Cross domain tracking

@mattab
Owner

By default Piwik will still work as it has.

So this feature will be used only by some people. When the user is logged in on the site or app, and the webmaster knows an attribute for this particular user that they can use as "unique identifier" for them. for example could use username, uuid, email address, etc.

This will bring much more accuracy to unique users detection and tracking over time. This is simple idea, yet a powerful feature!

Sometimes called Unique User tracking, Unique devices tracking.

@mattab
Owner

microsite.omniture.com/t2/help/en_US/sc/implement/index.html#CrossDevice_Visitor_Identification

@mattab
Owner

Test this code http://forum.piwik.org/read.php?2,113975 and check it works fine.

@anonymous-piwik-user

is it possible to link piwik with website login page so we can track usage by user name instead of by IP address? In other words we are using Piwik to monitor an agents usage of a website, and tracking by IP address is not as accurate as want.

@mattab
Owner

@db394r this is exactly the goal of this ticket! stay tuned

@mattab
Owner

I've been thinking about this and updated ticket description.

@anonymous-piwik-user

Replying to matt:

@db394r this is exactly the goal of this ticket! stay tuned

Is there any update on this feature. It is getting really hard for me to produce correct reports for my upper management. They are wanting me to look for other options for tracking the usage of our internal website.

Thank you for your response,
Daniel

@mattab
Owner

@Daniel maybe your upper management would consider sponsoring our time to work on this feature? it would help get it out quicker for sure.

Please contact us via: http://piwik.org/consulting/ if you can help!

@mattab mattab added this to the 2.5.0 - Piwik 2.5.0 milestone
@mattab mattab self-assigned this
@hpvd

Using this great feature, there should be a possibility to still know from where/which device which sites have been visited /which actions (events) have been made by the visitor.

Maybe one could give in the visitor profile:

  • the number of devices used by this visitor and
  • something like a filter e.g. with tabs to see "all visits", "visits from device 1", "visits from device 2" ....

Probably this is in details something to be implemented later but I could imagine that this is important for the technical design of this feature.

@arunvishun

Hi

Good to hear that this feature is being implemented in piwik.
Till the time it becomes available in piwik, is there a way to at least group the current visitor log based on username ? I use custom variable to track username. Appreciate any suggestions/help in this.

Thanks
Arun

@mattab mattab modified the milestone: Piwik 2.5.0, Piwik 2.6.0
@mattab mattab modified the milestone: Piwik 2.6.0, Piwik 2.7.0
@mattab
Owner

Probably this is in details something to be implemented later but I could imagine that this is important for the technical design of this feature.

@hpvd sure that's a great idea to extend Visitor Profile to show info of configurations across visits. could you create an issue for this idea and then we could hopefully schedule it!

@mattab mattab referenced this issue from a commit
@mattab mattab Refs #3490 User ID Tracker is now working:
- new user_id field to contain the raw user id value
- new &uid= tracker api parameter
- add userId to Live API output
- added integration test
d903c1f
@mattab mattab modified the milestone: Mid term, Piwik 2.6.0, Piwik 2.7.0
@mattab mattab referenced this issue from a commit
@mattab mattab Refs #3490 Adding segment 'userId==' + some '&segment=userId==' integ…
…ration tests + doc blocks
e2b61f5
@mattab mattab referenced this issue from a commit
@mattab mattab Refs #3490 Display User ID in the Visitor Profile, in the Visitor log…
… and Last visits widget link/tooltip opening the Visitor profile
fbe8c46
@hpvd

as proposed a new issue was opened: "visitorprofile: show detailled info about device usage" #6161

@mattab mattab referenced this issue from a commit
@mattab mattab refs #3490 JS lint + add test for Segment `userId` Auto Suggest
and restore Transitions tests which I deleted by mistake earlier
3c852d0
@mattab mattab added the c: Platform label
@mattab
Owner

To do before closing this ticket: create User ID user guide and FAQ and update resources.

@tsteur tsteur referenced this issue from a commit
@tsteur tsteur refs #3490 removed segment definition as it apparently depends on idS…
…ites which I do not quite understand why
c0a29a9
@mattab
Owner

feature is done! Check out the User ID user guide

@mattab mattab closed this
@mattab mattab referenced this issue from a commit
@mattab mattab refs #3490 Throw meaningful error when userId segment is used with an…
… unsupported segment match operator + test
252798d
@mattab mattab referenced this issue from a commit in PiwikPRO/plugin-AdvancedCampaignReporting
@mattab mattab Add nb_users to API responses refs piwik/piwik#3490 83e9c6f
@mattab mattab referenced this issue from a commit
@mattab mattab User ID is NULLable now results in expected tests results: nb_users =…
… 0 when no user id was set. refs #3490 #6162
b25624d
@kevinoid kevinoid referenced this issue from a commit in kevinoid/angular-piwik
@kevinoid kevinoid Add support for setUserId
This commit adds support for the new setUserId method added in
piwik/piwik#3490 and documented at https://piwik.org/docs/user-id/

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
4d41d63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.