Skip to content

Conversation

alenakhineika
Copy link
Contributor

@alenakhineika alenakhineika commented Mar 4, 2022

Description

In Compass, we don't have any MongoDB user identifiers. We randomly generate an ID the first time the product is run and then we use that as a user id. The userId telemetry field should not store the random UUID, it should store only AUID. The randomly generated UUID should be stored as anonymousId.
To not break statistics for existing users:

  • We should leave all current users with the tracking they have.
  • For new users, we should use the field anonymousID and fill it with a random UUID.

That being said:

  • If userId exists we send it to segment. We also copy userId to anonymousId and send it to segment as well.
  • If userId does not exist we do not create a new one, we only generate a random UUID and send it to segment as anonymousId.

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@alenakhineika alenakhineika requested a review from mcasimir March 7, 2022 10:40
Copy link
Collaborator

@mcasimir mcasimir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* Stores a unique anonymous user ID (uuid) for the current user
* @type {String}
*/
currentSegmentAnonymousId: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hyper super NIT, no need to change anything. Should this be called just segmentAnonymousId without current? i think "current" in currentUserId is an adjective of user rather than of id: "the id of the current user". Here it almost seems like there is a currentSegmentAnonymousId cause there may be another SegmentAnonymousId that's not "current".

* Stores a unique anonymous user ID (uuid) for the current user
* @type {String}
*/
currentSegmentAnonymousId: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another NIT, and again no need to change anything, but to your point of making this a bit more "generic" and less segment-specific, maybe another possible name could be telemetryAnonymousId. LGTM either way feel free to merge as is.

@alenakhineika alenakhineika merged commit dd8cde2 into main Mar 9, 2022
@alenakhineika alenakhineika deleted the COMPASS-5487-user-id-and-anonymous-id-segment branch March 9, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants