Userorbit does not use a separate userorbit.identify() method. User identity is set when you initialize the SDK, and it can be updated later with the identity helper methods.

Set identity on initialization

import userorbit from "userorbit-js";

await userorbit.init({
  accountId: "YOUR_ACCOUNT_ID",
  apiHost: "https://api.userorbit.com",
  userId: "USER_ID_FROM_YOUR_APP",
  email: "person@example.com",
  name: "Jane Doe",
  attributes: {
    "user.role": "admin",
    "user.company": "Acme"
  }
});

Available identity methods

  • userorbit.setEmail(email): updates the current user's email address.

  • userorbit.setAttribute(key, value): sets or updates one custom attribute.

  • userorbit.reset(): clears the current local SDK state.

  • userorbit.logout(): logs out the current identified user from the SDK session.

Custom attributes

Use attributes for targeting and segmentation. Keep keys stable and use values that your application can send consistently, such as plan, role, company, account ID, or signup date.

await userorbit.setAttribute("user.plan", "pro");
await userorbit.setAttribute("account.id", "acct_123");

When to call reset or logout

Call logout() when a known user signs out. Call reset() when you need to clear the SDK's local state, such as when switching accounts in a shared browser session.

Was this page helpful?