Skip to main content
identify() runs in the visitor’s browser, so anyone can open the browser console and call it with another person’s user ID. Verification lets Usertick tell a genuine ID from a typed one. Your server, which knows who is signed in, computes a hash of the user ID with a secret key that never leaves your server. Usertick computes the same hash and compares the two. Verification is optional and available on every plan. Responses keep working without it, and an unverified identity is marked as such.

When you need it

Verify your users when a response’s identity does something on its own:
  • Contacts. Only a verified identity creates or changes a contact in Email → Contacts.
  • CRMs, mailing lists and event tools. In Monitor and Enforced, only a verified identity’s email reaches HubSpot, Klaviyo, Mailchimp and the other tools that track people.
  • Workflows that act on the person, such as a message to their email or an update to their CRM record.
When you only read in the inbox who answered, identify() without a hash is enough.

How it works

The hash is the same every time for the same user ID and key, and it never expires. Your server can compute it when the user signs up, keep it with the user, and pass it on every page. A response that arrives with a matching hash is marked Verified in the inbox, in the API and in every integration.

Set it up

Settings → Developers → Identity walks through the setup in five steps and shows whether each one is done. Members whose role has the Manage developer settings permission see the page.
1

Create a secret key

Select Create secret key, copy the key, which starts with utid_, and store it in your server’s environment as USERTICK_IDENTITY_SECRET. Usertick shows the key only once, so copy it before you select I saved it. Never put the key in the page.
2

Identify the user on your page

Call identify() with the user’s hash as the third argument, as in Pass the hash to the page.
3

Compute the hash on your server

Compute the hash with the code for your server’s language in Compute the hash, and check it with Test a hash.
4

Check the results

Select Turn on Monitor. Usertick then checks every hash that arrives and lists each failure with how to fix it, while responses stay as they are.
5

Enforce

When the results show no more failures, select Switch to Enforced. Usertick first says how many identified responses so far had no valid hash.

Compute the hash

The hash is the HMAC-SHA256 of the user ID, written as 64 lowercase hex characters, with the secret key as the HMAC key. Every language has HMAC in its standard library, so nothing needs installing.
Use the secret key exactly as shown, including the utid_ prefix, and the user ID exactly as you pass it to identify(). A different spelling of either gives a different hash.

Check your code

To check your code before any response depends on it, run it with this key and these user IDs. It should give exactly these hashes. The second row checks that the user ID is read as UTF-8. With your own key, enter a user ID and its hash under Test a hash in Settings and select Check hash. Usertick checks them the way it checks a response and keeps nothing.

Pass the hash to the page

Where your server renders the page, put the user’s ID and hash in it, and pass the hash to identify() as { hash }:
The widget keeps the hash with the user ID until logout(). It checks only that the hash is 64 hex characters and logs a warning in the console when it isn’t. The other rules for identify() are in Identify your users. With a valid hash, the user ID counts as verified, and so do the email, name, company and traits sent with it, because they came from the page that had the user’s hash.

Choose a mode

The mode decides what happens to a response that arrives without a valid hash. A response is never refused because of its identity. Start with Monitor, fix what the results list, then select Switch to Enforced. Enforced requires a current secret key. Changing the mode asks an account with two-factor authentication for its code.

Read the results

In Monitor and Enforced, the Check the results step counts every response that came with an identity and lists the newest 50 failures with the time, the reason, how to fix it and the survey. The counts refresh every 30 seconds while the page is open, and Clear log starts them over after a fix. The results never hold a hash, a user ID or a trait. They are cleared 30 days after the most recent entry.

Rotate the key

Rotate the key when it may have leaked, or on your own schedule. Every user’s hash changes with the key.
1

Create the new key

Select Rotate key, then Rotate now, and copy the new key.
2

Deploy it

Put the new key in your server’s environment and compute new hashes with it. Hashes made with the previous key keep verifying for 24 hours, so nothing fails in between.
3

End the previous key

To stop the previous key before its 24 hours end, for example after a leak, select Delete now on it and type how it starts to confirm.
Rotating again within the 24 hours ends the older key at once, so at most two keys are active. Creating, rotating and deleting a key asks an account with two-factor authentication for its code. A link survey takes the identity from its address. When your system builds the link for a person, add uid=user_123&uh=HASH with that person’s hash. The hash never expires, so the link can go out by email or on paper. The page removes both parameters from the address bar once it has read them. A link with uid and no uh arrives unverified.

Questions

Yes. The page belongs to the signed-in user, and the hash proves only that user’s ID. The secret key can’t be worked out from a hash, and a hash doesn’t work for any other user ID.
They can send responses as that user, much like someone using that user’s signed-in browser. To make every existing hash stop working, rotate the key and select Delete now on the previous one.
A hash that never changes can be computed once and kept with the user, and it works in links sent by email. When you need every hash replaced, rotate the key.
No. A response keeps whether its hash verified. Test a hash and the results keep no hash either.
No. The widget behaves the same with or without a hash, and a response is never refused because of its identity.