Documentation Index
Fetch the complete documentation index at: https://docs.trodo.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Trodo assigns an anonymous id to every browser session. When you learn who a user is (after login or signup), callidentify() to link their anonymous activity to a stable identifier.
Browser vs. server. The browser SDK is the only environment where
identify changes persisted state — it rewrites the stored distinct id and merges the anonymous profile with the identified one. On the server, “identify” just records an identity link; you still pass distinctId on every subsequent call.Signatures
- JavaScript (browser)
- Node.js
- Python
Stable identifier for the user — database id, account uuid, Stripe customer id. Max 255 chars.
Basic usage
- JavaScript (browser)
- Node.js
- Python
Browser: when to call identify
After signup
Identify immediately so the signup event is attributed to the new identified profile — then set
set_once properties like signup date.Server: “identify” is just a server write
On the backend there is no session to merge — every call already passes a distinct id. Whattrodo.identify(id) / trodo.identify(id) does on the server is hit POST /api/sdk/identify, letting the backend merge engine link the distinct id to an application identity. The returned UserContext is a convenience — you can keep using trodo.forUser('user-42') instead.
- Node.js
- Python
Reset
Clear identity and start a new anonymous session. Always call on logout.- JavaScript (browser)
- Node.js
- Python
Identity merge behaviour
Whenidentify() runs, the Trodo backend:
- New id → converts the anonymous profile into an identified profile for that id.
- Existing id, same device → seamless merge.
- Existing id, new device → the server’s merge engine unifies the profiles and may return a
newDistinctId. The SDK updates its session map. - Group memberships → for browser users, the server returns the user’s existing group memberships and the SDK hydrates local state so Groups assignments stay consistent across devices.
Best practices
Use persistent ids
Don’t over-identify
Callidentify once per login — not on every click. The browser SDK remembers the id; re-identifying is wasted work.
Handle auth state changes
Related methods
User properties
Set persistent traits
Groups
Associate users with orgs and teams