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 or in the browser 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.
type Answers = Record<string, string | string[]>;const result = await UIKit.presentPaywall({
paywall: { placement: 'onboarding' },
onAction: ({ actionId, answers }) => {
if (actionId === 'finish_onboarding') saveProfile(answers); // { goal: 'strength', days: ['mon','wed'], email: 'a@b.com' }
},
});Getting the answers
| Where | How |
|---|---|
onAnswer | Every change, with the field ID, the new value (nothing, undefined on web, 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. On web it is added only when at least one question was answered. |
An embedded screen's onFinish | The same result. |
Web: handle.answers() | From mountPaywall. |
| Web: component | detail.answers on uikit-purchased, uikit-action and uikit-close, and uikit-answer for each change. |
Flows
A button with the action Go to another screen opens another screen inside the same frame. 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 (and URL sources on web) 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 site or app.
Analytics shows the counts in its Answers table. See Analytics.