Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUM-7795 Anonymous RUM Identifier #2172

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

maciejburda
Copy link
Member

@maciejburda maciejburda commented Jan 10, 2025

What and why?

Adds capability of tracking anonymous id (enabled by default). This data allows linking sessions coming from the same device.

How?

Following proposal from this RFC (internal) it reuses data store mechanism, and based on configuration it generates and reuses stored identifier.

This identifier is attached to UserInfo object (schema already updated), which is enriching other SDK events.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes
  • Add Objective-C interface for public APIs (see our guidelines [internal]) and run make api-surface)

@maciejburda maciejburda changed the title Maciey/rum 7795/anonymous RUM-7795 Anonymous RUM Identifier Jan 10, 2025
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 10, 2025

Datadog Report

Branch report: maciey/RUM-7795/anonymous-id
Commit report: 8dee753
Test service: dd-sdk-ios

✅ 0 Failed, 1970 Passed, 1789 Skipped, 1m 4.43s Total duration (1m 25.33s time saved)

@maciejburda maciejburda marked this pull request as ready for review January 10, 2025 16:29
@maciejburda maciejburda requested review from a team as code owners January 10, 2025 16:29
mariedm
mariedm previously approved these changes Jan 10, 2025
Copy link
Member

@mariedm mariedm left a comment

Choose a reason for hiding this comment

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

LGMT! Only a few minor comments.

DatadogRUM/Sources/Integrations/AnonymousIdManager.swift Outdated Show resolved Hide resolved
DatadogRUM/Sources/RUMConfiguration.swift Show resolved Hide resolved

featureScopeMock.set(anonymousId: "test")

anonymousIdentifierManager.manageAnonymousId(shouldTrack: false)
Copy link
Member

Choose a reason for hiding this comment

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

Should we test when the anonymousId is set but shouldTrack is false? In other words, should we delete this line in order to make sure that the anonymousId is nil even without calling again anonymousIdentifierManager.manageAnonymousId(shouldTrack: false).

simaoseica-dd
simaoseica-dd previously approved these changes Jan 10, 2025
/// is used to link RUM Sessions belonging to the same anonyomus user.
///
/// Default: `true`.
public var trackAnonymousUser: Bool
Copy link
Member

Choose a reason for hiding this comment

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

suggestion/ I'd consider renaming trackAnonymousUser to trackAnonymousUserID to emphasize that we’re persisting and using only ID, rather than tracking any personal user data. This explicit naming could also helps clarify that the data is purely non-personal, which might avoid confusion and potential privacy concerns. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Valid point, but AFAIK that's the API that was used in the browser.

Let me check if we can make an alignment.

If not - I'll make the docs more specific.

Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

It looks great overall 👌 - I only left suggestions on naming and documenting the public API.

Requesting a change tho, to add integration unit tests for this feature. Using real instance of the SDK + proxy and asserting that anonymous ID is generated and inserted into events of two RUM sessions started in two instances of the SDK. I can help and pair on this 🙌

maciejburda and others added 2 commits January 14, 2025 12:41
@maciejburda maciejburda dismissed stale reviews from mariedm and simaoseica-dd via 7ca3267 January 14, 2025 14:02
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.

4 participants