Every event belongs to a distinct id. Before someone signs in, the browser and mobile SDKs make up an anonymous id for the device. When they sign in, you call identify with your own user id, and AppHelm links the anonymous history to that person. Server SDKs never make up ids: each call names the person.
Get this right and funnels, retention, experiments and the person timeline follow one person from their first visit to their last purchase, across devices. Get it wrong and one person shows up as several, or several people as one.
#The ids
| Id | Where it comes from | Kept |
|---|---|---|
| Anonymous id | A random UUID the browser or mobile SDK makes on first use | Browser: localStorage (apphelm.distinctId), only after analytics consent. Mobile: the device (UserDefaults, SharedPreferences, shared_preferences, or React Native's storage) |
| Identified id | Your user id, passed to identify |
Beside the anonymous id, until reset() |
| Server distinct id | The id you pass to each server call | Not kept by the SDK |
Use an id that never changes and means nothing outside your system: your database's user id, not an email address or a username. The same id must be used on every platform for the same person.
Passing distinctId when you create the browser client starts it identified as that id. The Vue, Nuxt, Angular, SvelteKit and Next.js helpers also keep the anonymous id in a first-party cookie, apphelm_id (one year, SameSite=Lax, readable by the browser), so your server and the browser agree on who an anonymous visitor is.
#Identify at sign-in
Call identify once the person has signed in (or signed up), and again on each app start if you like: identifying the same person again without traits sends nothing.
No example for this step; showing Next.js.
"use client";
import { useEffect } from "react";
import { useApphelm } from "@sansavision/apphelm/next";
export function SignedIn({ user }: { user: { id: string; plan: string } }) {
const apphelm = useApphelm(); // null while server rendering
useEffect(() => { void apphelm?.identify(user.id, { plan: user.plan }); }, [apphelm, user.id, user.plan]);
return null;
}import { useApphelm } from "@sansavision/apphelm/react";
const apphelm = useApphelm(); // the client, or null before it exists
useEffect(() => { void apphelm?.identify(user.id, { plan: user.plan }); }, [apphelm, user.id]);import { useApphelm } from "@sansavision/apphelm/vue";
const apphelm = useApphelm(); // null while server rendering
await apphelm?.identify(user.id, { plan: user.plan });// `apphelm` is the object createApphelm() returned in your layout.
await apphelm.client.identify(user.id, { plan: user.plan });await analytics.identify(user.id, { plan: user.plan }); // resolves once flags reload for the personmobile.identify(user.id, { plan: user.plan });apphelm.identify(user.id, traits: ["plan": user.plan])Apphelm.identify(user.id, mapOf("plan" to user.plan))apphelm.identify(user.id, traits: {'plan': user.plan}, traitsOnce: {'signed_up': '2026-11-07'});// Node has no $identify helper: send the event with ingest.
await apphelm.ingest({
workspaceId: "org_…", productId: "prd_…", eventName: "$identify",
properties: { distinct_id: user.id, $anon_distinct_id: anonymousId, $set: { plan: user.plan } },
});apphelm.identify("org_…", "prd_…", distinct_id=user.id, anon_distinct_id=anonymous_id,
traits={"plan": user.plan}, set_once={"signup_source": "ads"})apphelm.identifyPerson(user.id, mapOf("plan" to user.plan))client.Identify(apphelm.Identify{
DistinctID: user.ID,
AnonDistinctID: anonymousID,
Traits: apphelm.Properties{"plan": user.Plan},
SetOnce: apphelm.Properties{"signup_source": "ads"},
})APPHELM.identify(distinct_id: user.id, anon_distinct_id: anonymous_id,
traits: { plan: user.plan }, set_once: { signup_source: "ads" })$apphelm->identify((string) $user->id, traits: ['plan' => $user->plan], setOnce: ['signup_source' => 'ads'],
anonDistinctId: $anonymousId);apphelm.Identify(user.Id,
traits: new Dictionary<string, object?> { ["plan"] = user.Plan },
setOnce: new Dictionary<string, object?> { ["signup_source"] = "ads" },
anonDistinctId: anonymousId);apphelm.identify(Identify::new(&user.id).set("plan", &user.plan).set_once("signup_source", "ads").anon_distinct_id(anonymous_id))?;Apphelm.identify(user.id, traits: %{plan: user.plan}, set_once: %{signup_source: "ads"}, anon_distinct_id: anonymous_id)curl -X POST https://apphelm.dev/api/v1/events \
-H "Authorization: Bearer $APPHELM_API_KEY" -H "Content-Type: application/json" \
--data '{"workspaceId":"org_…","productId":"prd_…","eventName":"$identify","properties":{"distinct_id":"user-123","$anon_distinct_id":"0b6f…","$set":{"plan":"builder"}}}'Every SDK sends the same event, $identify, with distinct_id set to your user id, $anon_distinct_id set to the id used before, and the traits as $set (and $set_once). Later events from the device carry your user id.
On the device, identify switches the id at once and keeps it across reloads or launches, until reset(). Flags are evaluated again for the person.
The first flag evaluation after identify names the anonymous id, so a flag set to keep its answer across sign-in gives the person the same variant they saw before.
On a server you pass the anonymous id yourself. Get it from the browser (analytics.distinctId() before identify, or the apphelm_id cookie the framework helpers set), or from the mobile app, and send it as the anonymous id. Without it the server's identify sets traits but links no earlier history.
#What identify does
- It links one way, earlier id → identified id. Events are never rewritten. Reports follow the link to the earlier id's events up to the moment it was made, and a privacy deletion of either side removes it.
- Funnels, retention, the person timeline, website visitor outcomes and ad evidence follow links, so the pages someone viewed before signing up count for the person they became. Trends count unique people by the id each event carried, so in a unique-people trend the anonymous visit and the signed-in visit are two ids.
- It never merges two identified people. The earlier id is not linked when it is already a customer's id, already linked to someone, or already the identified side of a link. From a server key, when both ids are customer profiles, the pair goes to Settings → Identity review for a person to decide.
- Identifying as someone else without
reset()switches the id but sends no$anon_distinct_id, so the two people stay apart. Callreset()at sign-out.
#Reset at sign-out
reset() gives the device a new anonymous id and forgets the identified id, super properties and groups. Without it, the next person to sign in on a shared device inherits the last person's id.
No example for this step; showing JavaScript (browser).
await analytics.reset(); // new ids, no registered properties or groups, flags reloadedmobile.reset(); // unsent events still goapphelm.reset() // opt-out is keptApphelm.reset() // also clears cached flagsapphelm.reset();apphelm.reset()In React, Vue and Next.js call reset() on the client from useApphelm(); in Svelte, on apphelm.client. Server SDKs keep no identity, so they have nothing to reset.
#Alias another id
alias tells AppHelm that another id belongs to the current person, for example the id an older system used. It sends $create_alias and links that id's earlier events to this person, under the same rules as identify.
No example for this step; showing JavaScript (browser).
analytics.alias(otherAnonymousId); // only a UUID-shaped id the SDK mademobile.alias(legacyId);apphelm.alias(legacyId)Apphelm.alias(legacyId)apphelm.alias(legacyId);apphelm.alias("org_…", "prd_…", distinct_id=user.id, alias=legacy_id)client.Alias(apphelm.Alias{DistinctID: user.ID, Alias: legacyID})APPHELM.alias(distinct_id: user.id, alias: legacy_id)$apphelm->alias((string) $user->id, $legacyId);apphelm.Alias(user.Id, legacyId);apphelm.alias(&user.id, &legacy_id)?;Apphelm.alias(user.id, legacy_id)#Person properties
Traits you pass to identify describe the person: plan, role, company size. What AppHelm does with them depends on who sent them, because a browser key can be copied by anyone.
| Sent from | Stored as | Can be used for |
|---|---|---|
A browser (ahl_pub_… key) |
Stated by the browser, kept apart from everything else | Insight filters and breakdowns as $stated.<key>, and display on the person's page. Never flag targeting, segments, customer states or anything else that decides |
A server or mobile app (ahl_live_… key) |
Customer traits on the person's customer profile, recorded as "product event, system observed" | Everything: insights (person:<trait>), segments, flag targeting, customer states |
| A server, with explicit provenance | Customer traits with the source you name | As above, with the source shown on the profile (below) |
$set overwrites a value; $set_once only fills a trait the person has no value for yet. $set_once is available in Python (set_once), Go (SetOnce), Ruby (set_once:), PHP (setOnce:), .NET (setOnce:), Rust (.set_once()), Elixir (set_once:) and Flutter (traitsOnce:).
Rules for customer traits (server and mobile): keys are lowercase letters, digits and _, starting with a letter, at most 80 characters; at most 50 traits per call; strings up to 500 characters; values are strings, numbers, booleans or null. Keys naming credentials or special-category data (password, token, card_number, ssn, health, religion, political and similar) are left out. Traits whose names look like contact details are recorded with the sensitivity pii, and insights only filter and break down by traits of standard sensitivity.
Rules for browser-stated traits: at most 30 scalar values per person and product; strings scrubbed and cut to 200 characters; keys starting with $, or naming a secret, contact detail or special category, are left out.
Break an insight down by a trait with person:plan, or by a browser-stated one with property:$stated.plan. See Breakdowns and filters.
#Customer profiles with provenance
For traits that decisions depend on (plan, seats, role), send the governed customer signal apphelm.identify from your server. Each trait carries where it came from and when, which the customer page shows and AppHelm's customer states and outcomes rely on. It never changes a device's distinct id; use it beside the analytics identify.
No example for this step; showing Node.js.
await apphelm.identify(user.id, {
traits: { plan: "builder" },
traitSources: { plan: { sourceType: "billing", sourceId: "stripe", verification: "integration_verified", observedAt: new Date().toISOString() } },
accountId: company.id, accountName: company.name, accountRole: "admin", isAccountAdmin: true,
});apphelm.identify("org_…", "prd_…", distinct_id=user.id, traits={"plan": "builder"},
trait_sources={"plan": {"sourceType": "billing", "sourceId": "stripe",
"verification": "integration_verified", "observedAt": observed_at}})client.Identify(apphelm.Identify{
DistinctID: user.ID,
Traits: apphelm.Properties{"plan": "builder"},
TraitSources: map[string]apphelm.TraitSource{"plan": {SourceType: "billing", SourceID: "stripe", Verification: "integration_verified", ObservedAt: time.Now().UTC().Format(time.RFC3339)}},
})APPHELM.identify(distinct_id: user.id, traits: { plan: "builder" },
trait_sources: { plan: { sourceType: "billing", sourceId: "stripe", verification: "integration_verified", observedAt: Time.now.utc.iso8601 } })$apphelm->identify((string) $user->id, traits: ['plan' => 'builder'],
traitSources: ['plan' => ['sourceType' => 'billing', 'sourceId' => 'stripe', 'verification' => 'integration_verified', 'observedAt' => gmdate('c')]]);apphelm.IdentifyCustomer(user.Id,
new Dictionary<string, object?> { ["plan"] = "builder" },
new Dictionary<string, object?> { ["plan"] = new { sourceType = "billing", sourceId = "stripe", verification = "integration_verified", observedAt = DateTimeOffset.UtcNow.ToString("o") } });let traits = json!({ "plan": "builder" }).as_object().unwrap().clone();
let sources = json!({ "plan": { "sourceType": "billing", "sourceId": "stripe", "verification": "integration_verified", "observedAt": observed_at } }).as_object().unwrap().clone();
apphelm.identify_customer(&user.id, traits, sources)?;Apphelm.identify_customer(user.id, %{"plan" => "builder"}, %{
"plan" => %{"sourceType" => "billing", "sourceId" => "stripe", "verification" => "integration_verified", "observedAt" => DateTime.to_iso8601(DateTime.utc_now())}
})curl -X POST https://apphelm.dev/api/v1/events \
-H "Authorization: Bearer $APPHELM_API_KEY" -H "Content-Type: application/json" \
--data '{"workspaceId":"org_…","productId":"prd_…","eventName":"apphelm.identify","properties":{
"externalUserId":"user-123","traits":{"plan":"builder"},
"traitSources":{"plan":{"sourceType":"billing","sourceId":"stripe","verification":"integration_verified","observedAt":"2026-11-07T09:00:00Z"}}}}'| Source field | Values |
|---|---|
sourceType |
onboarding_answer, auth, billing, crm, support, product_event, survey, human |
sourceId |
Where in that source, 1–200 characters ("stripe", a form id) |
verification |
user_stated, integration_verified, system_observed, deterministically_derived, human_entered |
observedAt |
When the value was true, ISO 8601 with a time zone. Required by the API. The Python, Go, Ruby, PHP, .NET, Rust, Elixir and Kotlin SDKs send the event's time (now, unless you pass a timestamp) for a source without one; Node's types require it, and iOS and a raw request must send it |
sensitivity |
standard (default), pii or restricted |
Every trait needs a source and every source a trait; otherwise the server refuses the signal with 422 invalid_customer_signal (several SDKs check this before sending). The signal can also carry accountId, accountName, accountRole, isAccountAdmin, isChampion, up to 8 consent decisions, and verifiedEmailHash: the SHA-256 hex of the lower-case email, which matches the person across products when the workspace allows cross-product identity. AppHelm never needs the email itself. Customer signals need a server key; a browser key gets 403 server_authority_required.
The iOS and Kotlin clients have the same call (identify(externalUserId:traits:traitSources:) on iOS, the core client's identify(externalUserId, traits, traitSources) on Kotlin), but because app keys ship inside the app, send profile traits from your backend when you can.
#Groups and accounts
A group is something people belong to: a company, a team, a project. Put events in a group to filter and break down insights by it (group:company), and set the group's properties so it becomes an account with a name, a plan and its members' activity on the Accounts page.
No example for this step; showing JavaScript (browser).
analytics.group("company", company.id); // later events on this page load carry itmobile.group("company", company.id, { name: company.name, plan: "scale" });apphelm.group(type: "company", key: company.id, traits: ["name": company.name, "plan": "scale"])Apphelm.group("company", company.id, mapOf("name" to company.name, "plan" to "scale"))apphelm.group('company', company.id, traits: {'name': company.name, 'plan': 'scale'});// The governed account signal; the group type is "account".
await apphelm.group(company.id, { sourceId: "crm", name: company.name, plan: "scale", seatCount: 40 });apphelm.group("org_…", "prd_…", "company", company.id, {"name": company.name, "plan": "scale"})apphelm.group("company", company.id, mapOf("name" to company.name))client.GroupIdentify(apphelm.GroupIdentify{Type: "company", Key: company.ID, Properties: apphelm.Properties{"name": company.Name, "plan": "scale"}})APPHELM.group_identify(group_type: "company", group_key: company.id, properties: { name: company.name, plan: "scale" })$apphelm->groupIdentify('company', (string) $company->id, ['name' => $company->name, 'plan' => 'scale']);apphelm.GroupIdentify("company", company.Id, new Dictionary<string, object?> { ["name"] = company.Name, ["plan"] = "scale" });apphelm.group_identify(GroupIdentify::new("company", &company.id).property("name", &company.name))?;Apphelm.group_identify("company", company.id, %{name: company.name, plan: "scale"})- On a device,
groupadds$groups: { company: "…" }to every later event (kept across launches on mobile; for the current page load in the browser) and, with traits, sends$groupidentify.reset()clears groups. - On a server, attach an event to a group on each capture call (Events), and set the group's properties with
groupIdentify. - Properties:
nameandplanfill the account's name and plan; up to 20 other scalar properties are kept beside them. - Group types: 1–40 letters, digits,
_or-, at most 5 per event. The typeaccountis the account Node'sgroup()and identify'saccountIdname, keyed by the key alone; any other type is its own account, keyedtype:key, so a project1and a company1never share one. - A browser can't create or change an account. A browser
$groupidentifyis ignored and counted. Browser events still carry$groups, so insights can use the group. - Node's
group(accountId, options)also takeslifecycleState,commercialValueMinor,commercialCurrency,commercialBillingInterval,renewalAtandseatCountfor revenue and account reports;sourceIdis required.
#Across devices and servers
AppHelm joins a person's activity by id, so the rule is simple: identify with the same user id everywhere.
- Web and mobile: each device starts anonymous and links its own history at its own
identify. After that, both carry your user id and count as one person. - Browser and server: server events with the user id join the browser's events once the browser is identified. For a visitor who has not signed in, send the browser's anonymous id as the server event's distinct id (read it with
analytics.distinctId(), or from theapphelm_idcookie with the framework helpers). - Sign-up on the server: if the account is created on your server, call identify there with the browser's anonymous id as the anonymous id, so the visit that led to sign-up counts for the new person. From a server key the anonymous id doesn't have to look like a UUID.
#What AppHelm stores
- Two hashes, not the id. Each event's person is stored as two independent 32-bit hashes of the distinct id, which together tell people apart like a 64-bit key. The browser computes them before sending, so ordinary browser events never carry the raw id; server and mobile SDKs send the id and AppHelm hashes it on arrival in the same way, so the same id joins up. The hashes are not salted: they keep raw ids out of analytics tables, but anyone who knows an id can compute its hash. Treat them as pseudonymous data, not anonymous data.
- Identity events (
$identify,$create_alias) carry raw ids so the link can be made. AppHelm keeps only the link, as hashes; their properties are never copied into analytics tables. - Customer profiles are keyed by a SHA-256 hash of the id scoped to your workspace and product.
- The raw request of every event, as it arrived (after your product's scrubbing rules), is archived for your plan's retention and then deleted. A privacy deletion removes a person's archived events too.
- Browser storage: the anonymous id, the identified id (
localStorage) and the session (sessionStorage) are written only after analytics consent. Withdrawing consent stops collection but leaves those keys; remove them yourself if your policy requires it.
#Privacy
- Use an opaque internal user id, never an email or a phone number. Ids are hashed, but an email is easy to guess and hash.
- Traits are personal data. Send only what you will use, and keep contact details out unless you need them; AppHelm masks them, but you remain responsible for them.
- On a shared device, call
reset()at sign-out so the next person starts fresh. - To export or delete everything about one person, use the privacy API (
POST /api/v1/privacy/export,POST /api/v1/privacy/delete) or the customer's page. Privacy, consent and data controls covers consent, retention and deletion.
#See people in AppHelm
- Customers lists customer profiles made by server and mobile identify, with traits and their sources, lifecycle state and a timeline of events (including the anonymous history linked at sign-in).
- Customers → Browser people lists people the browser SDK saw in the last 7 days who have no customer profile: anonymous visitors and people identified by the browser alone. Each opens a person page with their events.
- Accounts lists the groups
$groupidentifyandgroup()created, with their properties, members and activity. - Settings → Identity review holds pairs of identified customers that may be the same person, for an owner or admin to merge or keep apart.
The same data is in the API: GET /api/v1/customers and GET /api/v1/customers/{id} (customers:read), GET /api/v1/accounts/{id}, and GET /api/v1/identity/merge-candidates (customers:read, with a key for every product). Merging and splitting (POST /api/v1/identity/merge-candidates/{id}/approve, POST /api/v1/identity/{id}/split) need customers:write and a key created by an owner or admin. See the API reference.
#Check that it works
Sign in once
Open your app signed out, click around, then sign in. Identify runs.
Watch the events
Run
npx @sansavision/apphelm events tail --product prd_…. You should see$identify, and the events after it carrying a new person hash.Open the person
For a browser-only identify, open Customers → Browser people and find the person: the pages viewed before sign-in are on the same timeline. For a server or mobile identify, the person is under Customers with their traits.
Check for drops
Press Check connection in Setup. It lists identity events that were not linked or not stored, with the reason and the fix.
#Best practices
- Identify on every sign-in and sign-up, and reset on every sign-out. Both are cheap; skipping either splits or merges people.
- Use one id per person across web, mobile and server. Your database id is the right one.
- Send decision-making traits from your server. Browser traits are for display and analysis only.
- Set group properties from your server, and attach events to groups on every platform.
- Don't identify with ids that change, such as a session id or a device token.
#Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| One person shows as two after sign-in | identify wasn't called on that device, or the server used a different id |
Call identify with the same user id on every platform |
| Two people share one history on a shared device | reset() wasn't called at sign-out |
Call reset() on sign-out |
Setup shows already_identified |
The earlier id already belongs to an identified person, so it was not linked again | Call reset() when a user signs out, so the next sign-in starts from a fresh anonymous id |
Setup shows browser_id_not_anonymous |
A browser tried to link an id it didn't generate (a user id or email) | Let the browser SDK keep its own anonymous id, or link the ids from your server |
Setup shows browser_traits_ignored or browser_group_traits_ignored |
Traits or group properties came from a browser key, which can't change customers or accounts | Send them from your server with identify or groupIdentify |
Setup shows sent_to_review |
Both ids are identified customers | Approve or reject the pair in Settings → Identity review |
Setup shows invalid_identity_event |
distinct_id, $anon_distinct_id, alias, $group_type or $group_key missing |
Use the SDK's identify, alias and group, or send the fields above |
| Server traits never appear on the customer | Customer profiles are off (customer_intelligence_not_configured), consent is missing, or the active-customer limit is reached |
Save the customer model in Settings → Customer model; send consent with identify; check Plans & billing |
422 invalid_customer_signal from apphelm.identify |
A trait without a source, a source without a trait, a source without observedAt, or a key that isn't lowercase snake case |
Give every trait a complete source, including observedAt |
| A unique-people trend counts more people than the funnel | Trends count each id separately; funnels follow sign-in links | Expected. Use a funnel or retention when sign-in history matters |