Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback
Hey! These docs are for version 2.0, which is no longer officially supported. Click here for the latest version, 3.0!


_User IDs_ are used to uniquely identify the participants in your experiments. Supply any string you want for user IDs, depending on your test design.

For example, if you're running tests on anonymous users, you can use a first-party cookie or device ID to identify each participant. If you're running tests on known users, you can use a universal user identifier (UUID) to identify each participant. If you're using UUIDs, you can run tests that span multiple devices or applications and ensure that users have a consistent treatment.

User IDs don't necessarily need to correspond to individual users. If you're running tests in a business application, you may want to pass account IDs to the SDK to ensure that every user in a given account has the same treatment. Alternatively, you can use [bucketing IDs](πŸ”—ο»Ώ) to ensure these users get a consistent experience.

Here are more tips for using user IDs:

  • _Ensure user IDs are unique_: User IDs must be unique among the population you are using for tests. Optimizely buckets users and provides test metrics based on the user IDs that you provide.

  • _Anonymize user IDs_: The user IDs you provide are sent to Optimizely servers exactly as you provide them. You are responsible for anonymizing any personally identifiable data such as email addresses in accordance with your company's policies.

  • _Use IDs from third-party platforms_: If you are measuring the impact of your tests in a third-party analytics platform, we recommend leveraging the same user ID from that platform. This helps ensure data consistency and make it easier to reconcile events between systems.

  • _Use one namespace per project_: Optimizely generally assumes a single namespace of user IDs for each project. If you are using multiple different conventions for user IDs in a single project (for example, anonymous visitor IDs for some tests and UUIDs for others), Optimizely will be unable to enforce rules such as mutual exclusivity between tests.

  • _Use either logged-out or logged-in IDs_: Optimizely doesn't currently provide a mechanism to alias logged-out IDs with logged-in IDs. If you are running tests that span both logged-out and logged-in states (for example, test on a signup funnel and track conversions after the user has logged in), you must persist logged-out IDs for the lifetime of the test.