CallDocumentation Index
Fetch the complete documentation index at: https://docs.getmilana.ai/llms.txt
Use this file to discover all available pages before exploring further.
update() to attach or refresh user identity and metadata on the current session. Common use cases:
- Identify a user — when user information becomes available, pass it to associate the session with a real user identity. This unlocks user-level filtering in the dashboard and allows AI queries to reason about specific users.
- Add session context — attach metadata like the current workflow, experiment variant, or feature flags at any point during a session.
- Refresh user details — update user metadata (e.g. plan changes, new roles) as it changes during the session.
- React
- JavaScript
- Script Tag
UpdatePayload
update() accepts an UpdatePayload — an object with an optional user field, an optional session field, or both. You must provide at least one.
UserUpdate
Information about the user that persists across all of their sessions — things like their plan, team, country, or role. User metadata has upsert semantics across the user’s lifetime: any fields you provide are merged with previously set values, so you only need to send what has changed.A stable, unique identifier for the user in your system. This is the primary key Milana uses to link sessions to a user. Use your database user ID or a similar permanent identifier — do not use an email address as the primary ID.
The user’s email address. Used to connect user identity across your systems (e.g. support tools, CRM, data warehouse) and displayed in the dashboard.
The user’s display name.
Arbitrary key-value pairs to attach to the user. Keys are strings, values can be
string, number, boolean, null, or nested objects/arrays of the same types. e.g. plan, team, country, role, accountType.We strongly recommend including a createdAt key (ISO 8601 timestamp, e.g. "2024-03-15T00:00:00Z") so Milana can distinguish new users from returning users and support cohort analysis.SessionUpdate
Context that is specific to the current session — things like feature flags, traffic origin, experiment variant, or the current workflow. Session metadata has upsert semantics within the session: any fields you provide are merged with previously set values, so you can enrich the session progressively as context becomes available.Arbitrary key-value pairs to attach to the current session. Keys are strings, values can be
string, number, boolean, null, or nested objects/arrays of the same types. e.g. origin (e.g. "email-notification", "marketing-site"), featureFlags, experimentVariant, currentFlow.Return value
true if the update was applied to the session. false if the session was not active, the network request failed, or the session was not sampled.