Skip to main content

Overview

Fieldkit wants new-checkout on for Pro subscribers first, then a 10% slice of everyone else. Targeting rules live in the dashboard; the SDK only sends who is asking. This guide is the story of usr_8f2k19 (Jordan, plan pro) hitting checkout.

Identify

identify merges into later checks. Pass a per-call context to override:
Browser clients keep a stable anonymousId (default key shipdit:anonymousId) so pre-login and post-login traffic correlate. The same userId from server and client maps to one evaluated-entity row per environment. After identify(), the SDK fetches last-seen traits from GET /sdk/v1/identity and merges them under this session’s traits (request wins). Disable with remoteTraits: false. This is the same shape the dashboard uses:
apps/web/src/lib/shipd.ts

What the evaluator sees

Dashboard rules match on attributes (plan eq pro), percentage rollouts, and audiences (segments). Evaluation stays local — no Postgres on the check.

Percentage rollouts

A 10% rollout hashes flagKey + userId (unless the rule buckets on another attribute). The assignment is sticky with no stored state.
No userId (and no bucket attribute) → the percentage condition does not match → fallthrough (the flag default).

Audiences

Project-scoped segments compile into the snapshot. Rules reference them (kind: "segment"). Membership is not a server lookup; the SDK evaluates the segment’s conditions from context attributes.

Events

Identify (and evaluations in production) batch to POST /sdk/v1/events. identify upserts evaluated_entities asynchronously. Turn the pipeline off with events: false.

Next