Answers
Receive what users chose or typed on questions and multi-screen flows, and learn what is and is not sent to Miniwall.
Screens can ask questions (single choice, multiple choice, text field) and link to other screens. The SDK collects the answers on the device and hands them to your code.
The key is the question's Field ID set in the editor. The value is:
| Question | Value |
|---|---|
| Single choice | The chosen Answer ID, such as lose_weight. |
| Multiple choice | A list of Answer IDs, such as mon and wed. |
| Text field | The typed text. |
A question with no answer has no key. Emptying a text field removes it. See Flows and questions for building them.
Answers are [String: Flow.Answer], where Flow.Answer is .one(String) or .many([String]).
options.onAction = { actionId, answers in
if actionId == "finish_onboarding", case let .many(days)? = answers["days"] {
saveProfile(days: days) // ["mon", "wed"]
}
return true
}Getting the answers
| Where | How |
|---|---|
onAnswer | Every change, with the field ID, the new value (nothing once cleared) and all answers. |
onAction and onPurchase | Always have answers (empty if none). |
The result of present | answers is in purchased, restored, closed and action. |
An embedded screen's onFinish | The same result. |
Flows
A button with the action Go to another screen opens another screen inside the same presentation. A button with Back to previous screen goes back (on the first screen it closes). Answers carry across screens, and earlier answers stay selected when the user goes back. The first screen is the one the placement returns, so its A/B test, schedule and audiences apply to the whole flow. Linked screens are loaded ahead of time from their published versions. For JSON sources pass screens. If a linked screen cannot be loaded, the button reports the error to onError and stays.
Each screen of a flow counts as a view.
What is sent to Miniwall
Only for screens loaded by placement or paywall ID, and only with analytics on:
- A
viewfor every screen. - For choice questions, an
answerevent with the Field ID and the chosen Answer ID, sent when the user moves on, closes, buys or presses a button. One event per option, once. - Typed text is never sent. It can be an email or a name. It stays with your app.
Analytics shows the counts in its Answers table. See Analytics.