Traits

Traits are the optional second argument to identify(). They're flat key-value pairs attached to the user, used for filtering and segmentation in the dashboard.

Shape

A plain object. Values must be string, number, or boolean — nothing nested, no arrays, no null.

{
  email: "jane@example.com",
  name: "Jane Doe",
  plan: "pro",
  org_id: "org_0042",
  seats: 12,
  mrr: 299,
  beta_tester: true,
  signup_month: "2026-03",
}

Valid types

TypeExampleNotes
string"pro"UTF-8, any length
number12, 299.99Integer or float
booleantrueStored as literal boolean
undefined / missing{ plan: undefined }Treated as not-set
null{ plan: null }❌ Rejected
Array / object{ tags: ["a"] }❌ Rejected

Invalid entries are silently dropped. No error thrown.

Examples

React

import { useIdentify } from "@galacha/react";
 
useIdentify(user.id, {
  email: user.email,
  name: user.name,
  plan: user.plan,
  team_id: user.team_id,
  role: user.role,
});

Web (plain script)

Galacha.identify(user.id, {
  email: user.email,
  name: user.name,
  plan: user.plan,
});

React Native

Galacha.identify(String(user.id), {
  email: user.email,
  name: user.name,
  phone: user.phone_number,
});

What to send

Things that help you filter in the dashboard:

  • email, name for finding the user
  • plan, role, seats for filtering "all pro users"
  • team_id, org_id for cross-user aggregation
  • country, timezone for geo segmentation
  • signup_month for cohort analysis

Things to avoid:

  • Tokens, session cookies, JWTs (never put secrets in traits)
  • Full addresses, SSNs, payment details (privacy-sensitive)
  • Objects / arrays (rejected; flatten first)
  • Frequently-changing values like "last seen" timestamps (use server-side analytics instead)

Updating traits

Call identify() again with the same user ID and new traits. The new traits overwrite the stored values for that identifier.

// On signup
identify("user_042", { plan: "free", seats: 1 });
 
// Later, on upgrade
identify("user_042", { plan: "pro", seats: 12 });

Only the fields you pass are updated. Fields you omit keep their previous values.

Searching by trait in the dashboard

Open a project → Sessions → filter by trait. You can combine filters (e.g., plan:pro AND country:TZ).

Related