Skip to content

Show a survey manually

showSurvey shows one survey by its Survey ID. Use it when your code knows the moment better than a trigger could: a “Give feedback” button, the end of a support chat, a step in a flow.

The form needs the Mobile app channel switched on. It needs no triggers: a form without triggers is shown only by showSurvey. The Survey ID is on the form’s Share → Mobile app tab.

Responsly.shared.showSurvey("AbCd1234")

The call returns immediately. The survey loads in the background and appears when it is ready. The outcome arrives through callbacks: surveyShown, or surveyNotShown with a reason.

showSurvey respects most of the rules set in the Mobile app tab.

RuleApplies to showSurveyWith force
Tracking enabled (setTrackingEnabled)yesyes
Survey ID exists and the channel is onyesyes
No other survey visible or waitingyesyes
Scheduleyesno
Audience: platforms, app IDs, languages, identified, conditionsyesno
Frequencyyesno
Display guardyesno
pausenono
Pause between surveysnono
Share of usersnono
Delaynono

A survey shown with showSurvey still counts as a display for the frequency rules.

All four options are optional.

OptionTypeEffect
forceboolean, default falseSkips schedule, audience, frequency and the display guard.
hiddenFieldsmap of string to stringHidden-field values for this survey only.
localelanguage tagLanguage for this survey only.
presentationbottom_sheet, dialog or fullscreenOverrides the style set in the Mobile app tab for this call.
Responsly.shared.showSurvey("AbCd1234", options: ResponslyShowOptions(
force: false,
hiddenFields: ["order_id": "A-77"],
locale: "pl",
presentation: .dialog
))

force shows the survey regardless of audience, schedule and frequency, and without asking the display guard. Three things still stop it:

  • tracking is disabled (disabled),
  • the Survey ID is unknown or the channel is off (survey_not_found),
  • another survey is visible or waiting (another_survey_visible).

Use it for user-initiated surveys that must always open, and while testing.

Responsly.shared.showSurvey("AbCd1234", options: ResponslyShowOptions(force: true))

Values that belong to this one survey: an order number, a ticket ID, the screen the button was on. They are combined with the values from setHiddenFields; for a name present in both, the per-call value is used. See Hidden fields.

Shows this survey in the given language, whatever the device language or setLocale say. See Language.

Overrides the container style (bottom sheet, dialog, full screen) for this call. Size, auto-close and the close button still come from the Mobile app tab. See Appearance.

showSurvey does not report failure to the caller. If the survey is not shown, listeners get surveyNotShown with the reason, and the debug log has a line for it. Reasons specific to showSurvey:

ReasonCause
not_initializedshowSurvey was called before initialize. Unlike other calls, it is not remembered for later.
config_unavailableThe configuration could not be downloaded and there is no cached copy. Check the SDK key and the connection.
survey_not_foundThe Survey ID is not in the configuration: wrong ID, channel off, or a change made in the last 10 minutes that this device has not downloaded yet.
load_failedThe survey did not load within 15 seconds. The device is probably offline.

Every reason is listed in Testing & debugging.

closeSurvey closes the survey that is visible or about to appear. See Control when surveys appear.