Skip to main content

Use Case: Onboarding to Premium

The most common integration pattern for subscription apps. This guide walks through the full flow: app launch, onboarding with data capture, user identification, paywall presentation, purchase handling, and premium unlock.

What You’ll Build


Step 1: Initialize the SDK

Configure AppDNA as early as possible in your app’s lifecycle.

Step 2: Present Onboarding

The onboarding flow is designed in the Console — the SDK renders it natively. Present it on first launch:
On iOS and Android, flowId is optional — pass null to present whatever flow is currently active in the Console, letting you swap onboarding flows remotely without an app update. On Flutter and React Native, present takes a specific flow ID.

Step 3: Capture Quiz Answers via Callbacks

The onboarding delegate gives you every answer the user provides. Use these for personalization and segmentation.

Conditional Branching

Onboarding flows support conditional branching — the next step changes based on the user’s answer. This is configured entirely in the Console:
To configure branching:
  1. Open your flow in the Console (Onboarding > Flows)
  2. On a question step, click Add branching rule
  3. Map each answer option to a target step
The SDK handles the routing automatically — no code needed.

Step 4: Identify the User with Traits

After onboarding (or after login), link the user’s identity and pass the quiz answers as traits. These traits power experiment targeting, push segmentation, and analytics.

Handling Login

Depending on your app’s flow, user login can happen at different points: Login during onboarding — if your onboarding includes a signup/login step, call identify() in the step callback:
Login after onboarding — call identify() in your normal auth callback:
Before identify() is called, the SDK tracks events against an anonymous ID. Once you call identify(), all past anonymous events are automatically linked to the user.

Step 5: Present the Paywall

Show the paywall immediately after onboarding. The paywall is designed in the Console — the SDK renders it with built-in purchase handling.

Step 6: Handle Purchase Callbacks

React to purchase results via the paywall delegate:

Full Wired Example

Putting it all together in a single coordinator class:

What Happens Behind the Scenes

You don’t need to manage any of this — the SDK handles it automatically:
  • Onboarding config is fetched from the Console and cached locally (works offline)
  • Every step event is tracked automatically (onboarding_flow_started, step_viewed, step_completed, etc.)
  • User traits sync to AppDNA for segmentation and experiment targeting
  • Paywall config and product prices are resolved from cache
  • Purchases are verified server-side automatically
  • All events are batched and sent reliably (persisted to disk, retried on failure)
See Auto-Tracked Events for the full list of events tracked during this flow.