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.- iOS
- Android
- Flutter
- React Native
Step 2: Present Onboarding
The onboarding flow is designed in the Console — the SDK renders it natively. Present it on first launch:- iOS
- Android
- Flutter
- React Native
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.- iOS
- Android
- Flutter
- React Native
Conditional Branching
Onboarding flows support conditional branching — the next step changes based on the user’s answer. This is configured entirely in the Console:- Open your flow in the Console (Onboarding > Flows)
- On a question step, click Add branching rule
- Map each answer option to a target step
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.- iOS
- Android
- Flutter
- React Native
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, callidentify() in the step callback:
- iOS
- Android
- Flutter
- React Native
identify() in your normal auth callback:
- iOS
- Android
- Flutter
- React Native
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.- iOS
- Android
- Flutter
- React Native
Step 6: Handle Purchase Callbacks
React to purchase results via the paywall delegate:- iOS
- Android
- Flutter
- React Native
Full Wired Example
Putting it all together in a single coordinator class:- iOS
- Android
- Flutter
- React Native
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)

