Understanding who your users are and what actions they take is the foundational step for any data-driven product team. But in a world of multiple devices, app reinstalls, and anonymous browsing, how does an analytics platform like Amplitude consistently know if the user on your iPhone app is the same person who logged in from their desktop computer?
The answer lies in Amplitude’s robust, three-pronged approach to user identification.
This blogs, breaks down the three IDs Amplitude uses, and provides best practices for setting up the most powerful one: the User ID.
The Identification
Amplitude uses a combination of three different methods to identify and track your users, moving from the most general to the most precise identifier.
1. Device IDs
This is the most basic identifier, coming directly from the user’s device (e.g., an IDFA on iOS, a unique identifier on Android, or a cookie ID on web).
- When a user first installs or visits your product, before they have logged in or are otherwise identified.
- Limitation: It is unique to the device, not the person. If a user deletes and reinstalls the app, they may get a new Device ID, and if they switch to another device, their events will be tied to a different ID.
2. Amplitude ID (Anonymous ID)
The Amplitude ID is an ID that Amplitude automatically creates once it has enough information to conclusively identify a unique user, usually leveraging the initial Device ID.It’s an internal tracking ID that connects the events generated by a device until a definitive User ID is assigned.
3. User ID
The User ID is the unique identifier you set for individual users within your product. Using a User ID is optional, but highly recommended for accurate cross-device tracking and historical analysis.
Your product/website should set a user ID once a user has created an account, logged in, or is otherwise identified. This is the ultimate, definitive identifier for a real person.
The Power of User ID: Event Reconciliation
The true value of the User ID comes from how Amplitude uses it on the backend to maintain a single, accurate user profile.
1. Cross-Device Tracking
Once a User ID is assigned, Amplitude uses it to reconcile events across multiple devices under that same unique profile. If a user logs in on their phone, and then later on their desktop, all events from both devices are correctly attributed to one person.
2. Merging Anonymous History
This is where the magic happens. Amplitude merges a user’s event data on the backend, connecting the correct User ID to any anonymous events the user generated before the User ID was assigned (i.e., when they were only tracked by a Device ID).
For example, if a user browses your site anonymously, then logs in, all their pre-login browsing history is instantly connected to their now-identified User ID.
Best Practices for Setting User IDs
Since the User ID is the cornerstone of your tracking accuracy, it is critical to implement it correctly. A mistake here can lead to severely inflated user counts or merged profiles.
1. DO NOT Use Placeholders or Null Values
If you set the User ID to a generic placeholder like “None”, “Guest”, or even a blank string (“”) for multiple anonymous users, Amplitude will incorrectly assume all those users are the same person. All their events will be grouped together under that single placeholder User ID, rendering your data unusable.
Action: If a user hasn’t logged in, simply don’t set the User ID at all. Amplitude will continue to track them anonymously using their Device ID until they are identified.
2. DO NOT Use Changeable Identifiers
User IDs are fixed forever. Once set for a user, you cannot change them in Amplitude. For this reason, you must avoid assigning a user ID that might change.
- Bad Example: Setting a user’s email address as their User ID (emails can change).
- Good Example: Setting a stable, internal, and permanent identifier like a database Primary Key or internal User UID.
3. DO Pay Attention to Case Sensitivity
User IDs are case-sensitive. If you set a User ID as john.doe@email.com on one device and then as John.Doe@email.com on another, Amplitude will track two separate profiles for the same person. Ensure your User ID implementation enforces a consistent case (e.g., all lowercase).
