Launch Userorbit surveys in iOS and Android apps from tracked events, show them from code, or draw them with your own interface.
Surveys you publish in Userorbit can launch inside your iOS and Android app when a person does something you choose, like completing checkout or opening a screen. The SDK shows a native card at the bottom of the screen, follows your branching rules, and sends each answer back to Userorbit even if the device is offline for a while.
Before you begin
- Install the SDK: iOS or Android.
- On Android, add
userorbit-android-uiand callUserorbitUI.install(this)in yourApplicationclass. Without it, Android surveys load but nothing draws them. On iOS, the built-in card needs no extra setup. - Track the events you want to trigger surveys with
trackorscreen.
Launch a survey when someone triggers an event
- In Userorbit, create or open a survey and go to its targeting settings.
- Under When should this survey launch?, choose Auto start - When user triggers an event.
- Under Event triggers, add the event name your app tracks, for example
checkout_done. For screens, use the name you pass toscreen. Every session also starts with aNew Sessionevent you can use. - Optionally, add a delay before the survey shows.
- Publish the survey.
The next time the app tracks that event, the survey appears. Event names must match exactly, including case.
When a survey uses several trigger events joined with and, it launches only after the app has tracked all of them. Only one survey shows at a time. A survey the person has already completed or dismissed doesn't launch again.
What mobile surveys support
- Every question type, with your branching rules.
- Personalization placeholders such as
{{name|there}}, filled from the person's attributes. Identify the person first so their attributes are available. - Your survey's brand color and ending screen.
Surveys that use advanced eligibility rules in their targeting don't launch automatically on mobile yet. Use event triggers for mobile audiences, or show the survey yourself as described below.
Show a survey from your own code
To open a survey from a button or after a specific flow, call showSurvey with the survey ID:
// iOS
Userorbit.shared.showSurvey(id: "YOUR_SURVEY_ID")
swift
// Android
Userorbit.shared.showSurvey("YOUR_SURVEY_ID")
kotlin
The survey must be published and available to the current person. If another survey is already open, the call is ignored.
Draw your own survey interface
If the built-in card doesn't fit your design, set a renderer. The SDK hands it a SurveySession that holds the current question and handles branching. Your interface calls submit, back or dismiss.
// iOS: implement UserorbitSurveyRenderer
Userorbit.shared.surveyRenderer = MySurveyRenderer()
swift
// Android: the renderer is called off the main thread
Userorbit.shared.surveyRenderer = UserorbitSurveyRenderer { session ->
// show your UI, then drive the session
}
kotlin
On iOS, SurveyCard(session:) is public, so you can place the built-in card inside your own container. To turn surveys off entirely, pass surveys: false (iOS) or surveys = false (Android) in UserorbitConfig.
Where responses go
Answers are saved on the device and retried until Userorbit accepts them, so a response survives a lost connection or an app restart. Responses appear with the survey's results in Userorbit. The SDK also records $uo_survey_view, $uo_survey_dismissed and $uo_survey_completed events you can use in Analytics.
If a survey doesn't appear
- Confirm the survey is published and set to Auto start.
- Compare the trigger with the event name in Live Events, character for character.
- Check that the targeting doesn't use advanced eligibility rules.
- On Android, confirm
UserorbitUI.installruns and the visible activity extendsComponentActivity. - Test with a person who hasn't completed or dismissed the survey, or call
resetto start as a new anonymous person.
For more checks, see Troubleshoot the Userorbit mobile SDKs.