/identify, and returns a short-lived device token (dt_...). You forward that token to your server, which validates it and gets automation signals — headless browser detection, canvas randomization, timezone mismatch, replay protection.
How it works
1. Load the snippet
Add the snippet to your HTML. Use your publishable key (pk_live_...) — it’s safe to expose in the browser.
app/layout.tsx
2. Collect a device token
Calltracenow.identify() before the user submits a form. The call is async and typically resolves in under 200ms.
TypeScript
TypeScript (login form)
3. Validate the token server-side
On your server, pass the token to/validate before you act on it. Tokens are single-use — validating the same token twice returns an error, which catches replay attacks.
TypeScript (Next.js API route)
4. Pass the token to /trace
For a full risk evaluation, include thedevice_token in your /trace call alongside other signals. This gives the trace endpoint device-level context for your policies.
TypeScript
Token lifecycle
- Tokens expire after 5 minutes (
expires_in: 300). - Each token is single-use —
/validatemarks it consumed. A replayed token returns409 token_replayed. - If
identify()fails (network error, blocked by browser extension), handle it gracefully — don’t block the user action, just omit the token from the request and proceed without device signals.
TypeScript
