On this page
Use your own user ID to find website visits associated with an account in your system. Send a stable internal identifier, such as account-123. You do not need to send an email address, name or phone number to identify that account in CUX.
When to identify a user
Identification is optional. Use it when your website knows which account is active, for example after a successful login.
This ID comes from your application. It is separate from the visitor ID CUX assigns during collection. Keep the same internal ID for the same account within your CUX project.
Choose an ID without contact details
Use an existing account ID or an opaque identifier created for your integration. Keep the link between that identifier and the person's details in your own system.
Do not use an email address, full name or phone number as the ID. You do not need to hash an email for this integration.
An internal ID is not automatically anonymous. If your system can link it to a person, treat it as information associated with that person.
Send the ID from your website
Ask your developer to call this method after the CUX tracking snippet has initialized and your app knows the active account:
window._cux.send('identity', ['account-123']);
Replace account-123 with the active account's internal ID. This example contains a fictional ID, not a value you should use for every account.
'identity' tells CUX which type of information you are sending. The first value inside the array is your user ID. Call the method from your login or account-loading logic, rather than on every component render.
For a mobile app, use the matching SDK recipe in Identify mobile users.
Add attributes only when you need them
You can add an optional object as the second value in the array:
window._cux.send('identity', ['account-123', { plan: 'pro' }]);
Here, plan adds context about the account. It is not required for identification. Choose attributes that answer a specific analysis question, such as comparing journeys across subscription plans.
Do not send email addresses, names, payment details or entire account objects. Screenshot masking does not remove values sent through this method.
Check the result in CUX
- Use a test account with a synthetic internal ID.
- Log in and complete a short journey on your website.
- Open Visits in the matching CUX project and use the Identity filter to find the ID you sent.
- Check the matching visit and any attributes you included.
- Repeat with a second test account. The accounts should have different IDs.
If the ID is missing, check that the snippet was initialized and the identification call ran after login. Do not send additional personal information to make the visit easier to recognize.
Test logout and account switching
When switching accounts, send the new ID after the new account has logged in. Test login, logout and switching accounts in the same browser, then check which identity appears on each visit.
Do not send an empty ID as a reset. The identity method ignores an empty value; it does not clear the previous identity. If your integration needs identity clearing after logout, confirm the supported approach with CUX before relying on it.