Identify
Tell Remark the shopper’s email, phone, or name.
Verify
Verify the shopper’s identity with a signed token or one time passcode.
window.remark(...), which loads asynchronously. Your code needs to wait until it’s ready before calling it. The examples below do that with the whenRemarkReady helper from Waiting for Remark to initialize.
Remark can also verify shoppers without any code on your site, once your Remark representative turns it on. When a shopper needs to prove who they are, the widget can email them a one-time passcode and verify them once they enter it. See Verify with an email passcode.
Identify (unverified)
Useidentify to tell Remark who the shopper might be, so it can greet them by name or attach the conversation to a known shopper.
Fields
Every field is optional, but provide at least an
email or phone for the shopper to count as identified.
If you’ve connected Klaviyo, Remark also identifies shoppers who arrive with Klaviyo’s __kla_id cookie. It records the email, first name, and phone from their Klaviyo profile the same way identify does, without verifying them.
Verify with an email passcode
Remark can verify a shopper on its own, without any integration code needed on your site. When a shopper asks about something that needs a verified identity, such as their order history, the widget asks for their email address and emails them a one-time passcode. Once the shopper enters the code, Remark treats that email as verified. The whole flow happens inside the chat widget:- The shopper shares or confirms their email address.
- Remark emails them a one-time passcode.
- The shopper enters the code in the widget.
identify and verify: if you already verify signed-in shoppers with a token, they won’t be asked for a code, and shoppers who aren’t signed in to your site can still verify themselves when they need to.
Verify with a token
A signed token proves a shopper is who they say they are, so Remark can show order history, account details, or act on their behalf. Use it when shoppers sign in to your site, so they are verified as soon as the page loads and never need to enter an emailed passcode. Your server creates a short, signed token naming the shopper, and Remark checks the signature before it trusts the token. The one rule is to keep that signing secret on your server and out of the browser: as long as it stays there, no one can forge a token. Remark holds its own copy so it can check the signature.1. Get your signing secret
In the Remark dashboard, go to Settings → Identity verification and select Generate secret. Remark shows it only once, so copy it and store it somewhere only your server can read, such as an environment variable, and never in client-side code. To replace a secret later, use Regenerate. The new secret works right away, and any token signed with the old one stops working, so regenerate when traffic is low.2. Sign a token on your server
When you render a page for a signed-in shopper, create a short-lived JSON Web Token signed with that secret. The token must:- use the
HS256algorithm, - include the shopper’s
email,phone, or both, - set
subto the shopper’s lead, so the token only works for that shopper’s session, - set an expiry (
exp) no more than 5 minutes after Remark receives the token. Remark allows 60 seconds of clock difference and rejects tokens that expire later than that.
sub claim (subject above) is what ties the token to one shopper. Remark gives every visitor a lead and stores it in the remark_lead cookie on your domain, so it rides along with the request above. If your token endpoint can’t read that cookie, read the lead in the browser from localStorage under remark_lead and send it to your server. Unlike the email and phone, the lead is not sensitive, so reading it from the browser is fine: it only scopes the token to this session.
3. Verify from the page
Fetch a fresh token from your server when the page loads, then pass it to Remark:Sign a fresh token on each page load rather than storing one and reusing it.
On pages that stay open past the token’s
exp, such as single-page apps,
call verify again with a fresh token before it expires.Confirming it worked
If the token checks out, Remark records the shopper’s email and phone as verified until the token’sexp.
If a token is invalid, expired, or set to last too long, Remark rejects it. The page doesn’t get an error back, and nothing prints to the browser console unless the request itself fails. To confirm your tokens are being accepted, open Settings → Identity verification in the dashboard. The signing secret shows when it was last used: after a verified shopper loads a page, the badge changes from Never used to Used and the date.
Signing out
When the shopper signs out of your site, tell Remark to drop their verified status:Token reference
Remark normalizes the email and phone, so send real, well-formed values.