> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bily.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Client data

> Add only the approved customer context each Bily event needs.

Add `client` only when an event needs customer context. Its data applies to that event alone.

## Add verified customer context

Send only the fields your privacy policy and the customer's consent allow.

```typescript theme={null}
import { track } from "@bilyai/js";

track("user_signed_in", {
  client: {
    userId: "user_123",
    email: "buyer@example.com",
    firstname: "Ada",
    lastname: "Lovelace",
    userGroup: "growth",
  },
  organization_id: "organization_456",
});
```

## Choose the minimum fields

| Field         | Type          | Purpose                                                  |
| ------------- | ------------- | -------------------------------------------------------- |
| `userId`      | `string`      | Your stable customer or account ID                       |
| `email`       | `string`      | Customer email when permitted                            |
| `phone`       | `string`      | Customer phone when permitted                            |
| `firstname`   | `string`      | First name                                               |
| `lastname`    | `string`      | Last name                                                |
| `dateOfBirth` | `string`      | Date of birth only when strictly necessary and permitted |
| `gender`      | `string`      | Gender only when strictly necessary and permitted        |
| `userGroup`   | `string`      | Plan, segment, or account group                          |
| `address`     | `BilyAddress` | Approved city, state, postal code, and country fields    |

`BilyAddress` accepts `city`, `state`, `zip`, and `country`.

<Warning>
  Do not send customer data by default. Collect only what you need, and honor the visitor's consent and deletion choices.
</Warning>

## Read the browser identifier

Use `getBilyTrackingId()` when you need Bily's stable identifier for the current browser context.

```typescript theme={null}
import { getBilyTrackingId } from "@bilyai/js";

const trackingId = getBilyTrackingId();
if (trackingId) {
  console.info("Bily browser ID is available");
}
```

The return type is `string | null`. During server rendering, it returns `null`. It is not an authenticated user ID, credential, or authorization value.

## Keep each identity in its role

* Use `client.userId` for your authenticated account identifier.
* Use `getBilyTrackingId()` for the Bily browser identifier.
* Never treat either value as proof that a request is authorized.
* Do not place passwords, session tokens, or private keys in any event field.

<CardGroup cols={2}>
  <Card title="Tracking ID reference" icon="fingerprint" href="/api-reference/get-bily-tracking-id" />

  <Card title="Identity and attribution" icon="route" href="/guides/identity-attribution" />

  <Card title="Data safety" icon="shield" href="/privacy/data-safety" />
</CardGroup>
