Skip to main content

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

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.

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.

Reset on logout (TypeScript)

See reset.

Override per call

A context passed to an evaluation method wins over the identified one. Attributes merge key by key.
On servers, where one client serves many users, pass the context on every call:

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.
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.

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:
Browser clients also add location traits automatically. See Location traits in the browser.