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

# Identify users

> Set the evaluation context once per session with identify, override it per call, and clear it with reset.

## Overview

In the browser SDK (`shipdit/client`), `identify` sets the default evaluation context for a client: a `userId` plus traits. Targeting rules, audiences, and percentage rollouts read from it on every later check until you call `reset`.

On servers (`shipdit` and Go), one client serves many users. There, `identify` only records the user's traits for audience insights; pass context on every evaluation.

## Identify on login

```ts TypeScript theme={null}
// src/auth.ts (browser)
shipd.identify({
  userId: "usr_8f2k19",
  name: "Dana Reyes",
  traits: { email: "dana@fieldkit.dev", plan: "pro", beta: true },
});

shipd.isEnabled("new-checkout"); // evaluates as usr_8f2k19 with those traits
```

```go Go theme={null}
// auth.go
traits := map[string]any{"email": "dana@fieldkit.dev", "plan": "pro", "beta": true}
if err := client.Identify(shipd.Identity{UserID: "usr_8f2k19", Name: "Dana Reyes", Traits: traits}); err != nil {
    log.Printf("shipd identify: %v", err)
}
client.IsEnabled("new-checkout", shipd.EvaluationContext{UserID: "usr_8f2k19", Attributes: traits})
```

Both SDKs require a nonempty user ID. TypeScript throws for invalid identity; Go returns an error. In browsers, TypeScript traits become default context `attributes`. Server clients require them on each evaluation. See [`identify`](/reference/sdk#identify).

## Server identity events

On a server client (`shipdit` or Go), `identify` queues an event for audience insights. Pass traits separately on every evaluation; it does not change the client's evaluation context, and it does not fetch remote trait overlays.

See [Go Identify](/reference/go-sdk#identify).

## Reset on logout (TypeScript)

```ts theme={null}
shipd.reset();
```

See [`reset`](/reference/sdk#reset).

## Override per call

A context passed to an evaluation method wins over the identified one. Attributes merge key by key.

```ts theme={null}
shipd.identify({ userId: "usr_8f2k19", traits: { plan: "free" } });

shipd.isEnabled("new-checkout", { attributes: { plan: "pro" } });
// userId: usr_8f2k19, plan: "pro"
```

On servers, where one client serves many users, pass the context on every call:

```ts TypeScript theme={null}
shipd.isEnabled("new-checkout", { userId: req.user.id, attributes: { plan: req.user.plan } });
```

```go Go theme={null}
client.IsEnabled("new-checkout", shipd.EvaluationContext{
    UserID: user.ID,
    Attributes: map[string]any{"plan": user.Plan},
})
```

## Anonymous ID in the browser

`shipdit/client` creates an `anonymousId` and stores it in localStorage (key `shipdit:anonymousId`), so a visitor's sessions before and after login can be correlated.

```ts theme={null}
shipd.getAnonymousId();
```

Pass the `anonymousId` option to use an ID you already have, or `onAnonymousId` to be called when the client assigns or rotates one. See [`createClient`](/reference/sdk#createclient).

## Remote traits (browser)

After `identify`, the browser SDK fetches the traits shipd last stored for that user and merges them under the ones you passed (yours win). Turn it off:

```ts theme={null}
createClient({
  sdkKey,
  remoteTraits: false,
});
```

Browser clients also add location traits automatically. See [Location traits in the browser](/flags/targeting#location-traits-in-the-browser).

## Related

* [Target users by attribute](/flags/targeting)
* [`EvaluationContext`](/reference/sdk#types)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.