Skip to main content
Send information about your customer so Obi knows who it is guiding. This powers reporting, segmentation, targeting, and personalization. Without it, you only get basic session-level reporting.

Send customer information

Pass a user object to the update command:
window.ObiSDK("update", {
  isActive: true,
  user: {
    id: "user-123",
    email: "user@example.com",
    firstName: "John",
    lastName: "Doe",
    company: "ACME",
    role: "admin",
    plan: "enterprise",
    location: "AU",
    department: "acquisition",
    language: "en",
    other: "high profile client",
  },
});
Any field is allowed in the user object. Fields not in the recommended list are kept as metadata for the agent. Fill in as many of these as you can. They unlock off-the-shelf targeting and configuration for the agent.
type UserType = {
  id?: string;        // any internal identifier for the user
  userId?: string;    // synonym for "id"
  email?: string;
  firstName?: string;
  lastName?: string;
  company?: string;
  role?: string;
  plan?: string;      // the user's current plan
  location?: string;
  department?: string;
  language?: string;
  [key: string]: any; // any other field is kept as metadata
};
The more recommended fields you send, the less per-customer configuration the agent needs. email is especially useful. It is also how the User Context API matches an onboardee.

When to send it

Send it as soon as you know who the customer is, normally right after they sign in. See Controlling sessions for the recommended login flow.

Server-side context

The user object is set in the browser. To attach context from your backend instead, or in addition, use the User Context API, which matches the onboardee by email.