Track unique users
Amplitude counts unique users by combining three identifiers (device ID, user ID, and Amplitude ID) into a single profile across anonymous sessions, sign-ins, and multiple devices. Send a stable user ID as soon as a person authenticates so anonymous events on the same device merge into one profile and your active-user counts stay accurate.
How Amplitude identifies unique users
The three IDs work like this:
- Device ID: For mobile applications, Amplitude pulls the Identifier for Vendors, IDFV, or generates a random alphanumeric string for the device ID. For web applications, Amplitude sets the device ID to a randomly generated Universally Unique Identifier, UUID, by default. The device ID persists unless a user clears browser cookies or browses in private mode.
- User ID: You configure the user ID. Many products use a username or an internal unique identifier as the user ID. Use a stable value for the user ID. Don't assign anonymous users a user ID. Anonymous users still have Amplitude IDs and device IDs, so Amplitude might recognize them as the same user later.
- Amplitude ID: After Amplitude receives a device ID, a user ID, or both, Amplitude generates the Amplitude ID and associates it with the collected identifiers. Amplitude needs only one identifier to generate an Amplitude ID. Amplitude prefers the user ID because multiple unique users could share the same device.
If Amplitude encounters a known device ID that is already tied to a user ID in a different project, Amplitude assumes the device ID is tied to that user ID in all projects, even if you don't have the Portfolio add-on. For more information, refer to Portfolios.
When multiple projects reside in a single organization, all projects must use the same variable as the user ID. Using the same user ID variable prevents tracking discrepancies. For example, if one project uses email addresses as user IDs and another project uses phone numbers, Amplitude doesn't merge those identifiers into the same Amplitude user profile. If you're on MTU billing, you might incur charges for multiple users.
Use advertising identifiers as the device ID
You can configure Amplitude to use the Identifier for Advertiser, IDFA for iOS, and the Advertising Identifier, AdID for Android, as the device ID. For more information, refer to the relevant SDK installation guide. Using advertising identifiers causes the device ID to persist across installs.
iOS users can reset the IDFA on their devices at any time. As of iOS 10, if a user limits ad tracking, iOS returns an IDFA of all zeros. Amplitude instead sets the device ID to either the IDFV or a randomly generated string.
Android users can reset the AdID on their devices at any time.
Set up cross-domain tracking
You can track anonymous behavior across two domains. For example:
- Site 1:
https://www.landingpage.com. - Site 2:
https://www.productpage.com.
To track an anonymous user who starts on Site 1 and navigates to Site 2, pass both the device ID and session ID from Site 1 as URL parameters to Site 2. Passing only the device ID preserves anonymous identity but doesn't maintain session continuity. Sessions that split across the domain boundary can distort session-based metrics like traffic source analysis.
For Browser SDK 2 (@amplitude/analytics-browser v2.8.0 and later):
- From Site 1, get the device ID from
amplitude.getDeviceId()and the session ID fromamplitude.getSessionId(). - Pass both values to Site 2 as URL parameters when the user navigates. For example:
https://www.productpage.com?ampDeviceId=DEVICE_ID&SessionId=SESSION_ID. - Initialize the Amplitude SDK on Site 2 with
amplitude.init('YOUR_API_KEY'). The SDK readsampDeviceIdandampSessionIdfrom the URL automatically.
A custom time-based session definition can supplement session-based reporting, but it doesn't replace passing ampSessionId for true SDK session continuity across domains. For full implementation details, refer to Cross-domain tracking in the Browser SDK 2 documentation.
How Amplitude assigns Amplitude IDs
Amplitude resolves each device ID and user ID combination to a single Amplitude ID. Which profile a set of events lands on depends on the order Amplitude sees those identifiers in, and whether anonymous events preceded a sign-in.
Five scenarios cover the common cases, including what happens when one person signs in on several devices and when Amplitude merges or declines to merge profiles. Refer to How Amplitude assigns Amplitude IDs.
Was this helpful?
For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.