Skip to Content
AI Powered Docs! 🤖 These docs are translated with AI, so keep an eye out for minor quirks. We're always improving!

Identifying Users and Creating a User (For Automation Service)

To identify the user currently interacting with your website and allow Metrix servers to associate received actions with that user, you must call the following method before any other methods. This method creates a User on Metrix servers, which can be viewed in the User Lookup section of the Metrix dashboard.

authorizeUser(customUserId: string) : void
NameTypeDescriptionRequired
customUserIdstringA unique identifier assigned to the user on your website — for example, a username or any other unique ID.Yes

To revert the user to an anonymous state during logout, call:

deauthorizeUser() : void

Updating User Information (For Automation Service)

After calling authorizeUser, you can update the User’s information in User Lookup using the following methods:

setFirstName(firstName: string) : void
setLastName(lastName: string) : void
setEmail(email: string) : void
setHashedEmail(hashedEmail: string) : void
setPhoneNumber(phoneNumber: string) : void
setHashedPhoneNumber(hashedPhoneNumber: string) : void
setCountry(country: string) : void
setCity(city: string) : void
setRegion(region: string) : void
setLocality(locality: string) : void
setGender(gender: string) : void
setBirthday(birthday: string) : void
setCustomAttribute(key: string, value: string) : void

Retrieving the User ID (Optional)

For each user identified by a customUserId, Metrix generates a unique automationUserId on its servers. This ID becomes available immediately after the user is created and can be retrieved using:

onAutomationUserIdReceived().then((automationUserId: string) => { // todo });

In most cases, you do not not need to manually retrieve or store the automationUserId, unless you have a specific use case that requires it.