# Define new users **Choose a new-user event for each app.** This is required for SDK acquisition and retention, even for a brand-new app. Event delivery can work while these reports remain unconfigured. There is no special SDK call to mark a new user: Appbase uses events you already collect. ## Choose an event | App situation | A suitable definition | What it measures | | -------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | | New app, instrumented from launch | `app_first_open`, no properties | First observed SDK installation; reinstall/storage loss can count again without account identity | | Existing app with an initial onboarding flow | `onboarding_started` plus `flow_id` | First recorded entry into that flow; audit replay, returning-user and upgrade paths | | Account-based product whose entry is signup | Your existing `account_created` event | New accounts; anonymous use before signup is excluded | | Existing app with no reliable entry event | Leave unconfigured until an event or evidenced history is available | Activity and billing still work; acquisition remains unknown | Choose entry before drop-off if you want all entrants. `onboarding_completed` counts completers; it understates entrants and changes conversion denominators. A paywall or purchase event counts only people who reached that point. Do not infer acquisition from entitlement absence, a fresh local flag or the first time an upgraded app runs Appbase. `app_first_open` is automatic when the SDK creates durable installation state. Installing Appbase into an existing app makes old users first seen too. Selecting this event is an explicit measurement choice, never an automatic fallback. Consistent `identify(userId)` calls combine linked installations; unlinked reinstalls cannot be recognized as the same person. ## How it is set The coding agent sets it through the API below, usually during [setup](/docs/agent-setup.md#new-user-definition): one definition covers every build. The dashboard does not show or edit it; read it back with `GET` below. A definition is one exact event name plus optional exact property matches, such as `flow_id` = `arch-onboarding`. Every property must match. Avoid filtering by flow version unless acquisition should intentionally exclude other versions. Preview before saving: earlier observed activity is a review hint, not proof of an old user, because automatic first open often precedes onboarding. Existing events contribute as soon as it is saved; a new app can save before any matches arrive. Property values are text, numbers, booleans and null. Quote numeric text (for example `"42"`) to distinguish it from a number. Missing properties do not match null. There are at most 10 property filters; arrays, nested values, SQL, regular expressions and arbitrary query expressions are unsupported. Saving a different definition recalculates historical SDK acquisition, conversion and retention on the next read. Reports expose the current definition, revision and update time. Clearing it makes SDK acquisition unavailable. Changes never alter events, billing records or identity links. ## Configure through the API Agents configure it with existing app-scoped **setup access**. No new credential is needed. Collection keys cannot configure it; **analytics access remains read-only**. The owner API has the same operations under `/v1/admin/apps/:id/acquisition-definition` with account authorization. Use `Authorization: Bearer apb_setup_…` and the app ID from `POST /v1/agent/apps` or `GET /v1/agent/setup`: ```http GET /v1/agent/apps/:id/acquisition-definition ``` An unconfigured app returns `{ "definition": null, "revision": 0, "updated_at": null }`. Preview without saving: ```http POST /v1/agent/apps/:id/acquisition-definition/preview Content-Type: application/json { "definition": { "event": "onboarding_started", "properties": { "flow_id": "arch-onboarding" } } } ``` The aggregate response contains `configuration`, `proposed`, `matched_events`, `users`, `first_match_at`, `last_match_at`, `users_with_earlier_activity`, `historical_imports` and `as_of`. No raw events or user identities are returned. Save with the revision you read: ```http POST /v1/agent/apps/:id/acquisition-definition Content-Type: application/json { "definition": { "event": "onboarding_started", "properties": { "flow_id": "arch-onboarding" } }, "revision": 0 } ``` The response is the saved configuration. Omitted `properties` defaults to `{}`. Repeating the same definition with the current revision is a no-op. A stale revision returns **409**; read again and review the current setting before retrying. To clear, send `{ "definition": null, "revision": CURRENT_REVISION }`. Malformed definitions return **400**; an app outside the credential scope returns **404**. Setup expiry/revocation is enforced on every call. Saves and previews use stored Appbase data and do not call RevenueCat or another analytics provider. `GET /v1/agent/setup` reports the app's `acquisition` object with the configuration, `status` (`unconfigured`, `awaiting_event`, `observed`), `matched_events`, `users` and `first_match_at`. Receipt of any event is not proof that acquisition is configured. Read-only analytics context exposes `new_user_definition` and acquisition availability; New business and App health report payloads include the same definition. Agents must read that metadata before interpreting “new users.” See [agent analytics](/docs/agent-analytics.md). ## Counting and coverage - Only stored SDK events match. Appbase chooses the **earliest matching occurrence across the identity's lifetime**, then applies the report date filter. Repeats, restarts, another date selection or linked installations do not count the same resolved user again. - Every exact scalar property filter must match with the same type. Other event properties are allowed. Future events are excluded until their occurrence time. Normal collection deduplication, consent, offline delivery and environment isolation still apply. - New business assigns subsequent verified trials and first payments to that acquisition cohort. Billing identity links are still required. Revenue and Subscriptions retain their own transaction-based populations. - Active users still require actual app opens. Retention starts at the selected new-user event and measures opens on exact return days (in the report's time zone). Imported dates never manufacture historical activity. - Unconfigured and configured-with-no-matches are different states. Before available acquisition evidence, values remain unavailable. Quiet dates after evidence starts show zero observed matches, not proof of complete tracking. `new_user_since` is an evidence boundary, not a completeness promise. ## Agent acceptance checklist 1. Inspect existing app entry, restoration, upgrade, onboarding and identity code. Explain what the chosen event measures and which users it excludes; do not select an event merely because it has data. 2. Read the app's saved definition. Preview the proposed event and filters; save only within the owner's integration authorization. If the intended population cannot be determined, explain the uncertainty rather than silently classifying old users as new. 3. Test development: entry qualifies; repeats and linked identities count once; unrelated/returning paths and mismatched filters do not qualify; production is untouched by fixtures. Check setup acquisition status independently of delivery counts. 4. Verify New business and retention use the saved definition, and verify billing links separately. Record the definition and its limits in the consuming app's integration documentation. 5. Configure production using audited real events. If the released app already sends the event, this needs no mobile release or Apple review. If instrumentation is missing, shipping that app code still requires the app's normal release process. Do not create historical events to fill gaps. ## Migration from the removed helper React Native **0.4.0** and Swift **0.3.0** remove `markNewUser()` and its local marker flag. Remove calls when upgrading; reuse an existing entry event or ordinary `track(name, properties)`. Keep the same collection configuration, storage namespace and account identity. Existing durable identity and queued schema-v1 events remain readable. Publishing an SDK does not update installed apps. Older installed SDKs may still send `app_new_user`; those events remain accepted as ordinary events. They have no automatic acquisition meaning. If their placement was audited, explicitly selecting `app_new_user` can preserve that population using the same generic event definition. No legacy helper mode or default inference is retained. Published archives and tags are immutable; the [changelogs](/docs/sdk-changelog.md) list available versions. ## Historical users and reversible imports Published [historical-user imports](/docs/history-imports.md) remain separate evidence. Acquisition uses the earliest supported SDK or imported date per resolved identity; uncovered historical gaps remain unavailable. Changing a definition while acquisition imports are published returns 409: withdraw them, review their dates against the new definition, then create and publish corrected imports. Withdrawn imports cannot be republished. Identity-only imports do not block definition changes. Preview reports the count of all published imports, so inspect their scope before changing anything. Never withdraw real imports merely to bypass this check without authorized review.