Custom survey views
Custom survey views empower mobile developers to build 100% native, fully customizable survey experiences directly within their apps. Unlike the WebView-based Digital surveys available until now, this feature provides a new programmatic API to access survey form data and submit responses while preserving core SDK capabilities such as targeting, quarantine, and analytics.
The advantages of using a custom survey view in your app include:
- Security-first: Avoid the potential vulnerabilities and compliance risks associated with WebViews
- Complete UI Freedom: Build survey experiences that align precisely with your brand and UI standards
- Performance Boost: Eliminate dependency on WebViews, reducing load time and improving responsiveness
- Targeted and Integrated: Continue leveraging SDK's targeting and quarantine logic with your custom UI implementation
This documentation describes how to configure a Digital In-app SDK property to use custom survey views and provides an overview of the methods available when using custom survey views. See the developer documentation for more information.
General information
- Supported in SDK 4.9 and above
- Supported in Native SDK on both Android and iOS
- Cross platform frameworks such as REACT and Flutter are currently not supported
The key capabilities are:
Capability | Description |
---|---|
Native SDK Integration | Fully native experience with no WebViews involved |
API-driven Data Retrieval | Retrieve survey structure and logic using SDK methods |
Custom UI Freedom | Build UI with your own components using our data schema |
Response Submission | Submit user responses programmatically using SDK |
Targeting and Quarantine Support | Integrated with existing Digital Feedback targeting and quarantine logic |
Code-trigger Support | Fetch form data ahead of time using form ID |
Conditional Logic | Respect complex logic and visibility conditions defined in the survey data |
Analytical Events | Track key survey lifecycle events |
SDK Integration Guide
In addition to the code changes required, you need to configure the survey forms you want to use with custom survey views.
- In the Digital Command Center, navigate to the survey form you want to configure.
- Open the Form Settings for the survey, and under Form View enable the Custom View option.
- Click Save Changes. This disables the visual Form Designer and reminds you that you have to build your UI natively. Important: The survey is now using a custom survey view and so is no longer triggered by Digital. Now the app becomes responsible for using this survey to collect feedback. See Developer overview.
Developer overview
Digital survey forms configured to use a custom survey view rely on the app to use the form to collect feedback. Digital In-app SDK provides the custom survey view APIs for retrieving the survey form's structure and submitting responses. The app collects the response, sends to to Medallia and the signal is then fed into Experience Cloud in the same way as any other feedback collected using Digital WebView based surveys.
This overview shows the basics of how an app works with Digital custom survey views. The app retrieves a data structure that represents the survey as defined in the Command Center. The type of survey being used controls how you retrieve the data structure. For a survey form that relies on a code trigger, the form is retrieved directly. For a survey form that relies on an invitation trigger, the app has to receive a trigger and then retrieve the form data.
Retrieve survey form data
For survey forms using a code trigger, the survey targeting is controlled by the app. Use getCustomFormData(formID)
to retrieve the survey data structure of a FormID.
- Works only for survey forms configured for custom survey view
- Returns
MDCustomFormData
survey data structure - Handles exceptions such as invalid ID, survey not found, or SDK not initialized
MDCustomFormData customFormData = MedalliaDigital.getCustomFormData(formId);
The app then uses this data to display the survey form using your custom UI. See survey responses for the next step.
Receive a trigger
For survey forms using an invitation trigger, the survey targeting is controlled by Digital. When a WebView-based invite is targeted it is displayed automatically. For custom survey views, when a survey form is targeted your app needs to react to the trigger coming from Digital, determine which FormID to retrieve and display the survey form using your custom UI.
Depending on the programming language being used, add a Listener or Delegate which triggers when a custom survey view should be displayed. The result is a MDCustomFormListenerData
object containing the FormID of the targeted survey. Once the FormID is available from the listener or delegate, use the getCustomFormData method to retrieve the targeted survey.
MedalliaDigital.setCustomFormListener(new MDCustomFormListener() {
@Override
public void onCustomFormTrigger(MDCustomFormListenerData customFormListenerData) {
if (customFormListenerData != null && customFormListenerData.getFormId() != null) {
String formId = customFormListenerData.getFormId();
printMessage("Custom form triggered with ID: " + formId);
// Call the getCustomFormData API to get the form data
getCustomFormData(formId);
}
}
});
The app then uses this data to display the targeted survey form using your custom UI.
Survey responses
Once a survey form is displayed, the app needs to inform Digital about the response. This includes both the possibility that feedback is submitted, or that the user declined to provide feedback.
Use submitForm()
to submit feedback.
- Required responses must be provided, otherwise the SDK rejects the submission with an error code
- Your app is responsible for hiding or dismissing the survey after this call
MDCustomFormData customFormData = MedalliaDigital.getCustomFormData(formId);
MDFormSubmissionResult submissionResult = customFormData.submitForm();
if (!submissionResult.isSuccess()) {
Log.e("CustomFormDialog", "Form submission failed: " + submissionResult.getErrorMessage());
} else {
Log.d("CustomFormDialog", "Form Submitted Successfully");
}
If the user has declined or closed the survey, use the declineForm()
method to inform Digital about the response. Your app is responsible for hiding or dismissing the survey after this call.
MDCustomFormData customFormData = MedalliaDigital.getCustomFormData(formId);
customFormData.declineForm();
Survey data structure (MDCustomFormData)
When a survey configured to use custom survey views is retrieved as a MDCustomFormData
, the app needs to display the survey based on a structured payload object that describes:
- Form settings (title, colors, buttons)
- Different survey components
- Component details (type, label, validation, conditions, alternatives)
Supported components include:
Component Type | Description | Validation Type |
---|---|---|
label | Static text (HTML supported) | No validation |
image | Embedded image | No validation |
grading | 1–5 scale (stars/emoticons/etc) | Value between 1 to 5 |
grading1to7 | 1–7 scale slider | Value between 1 to 7 |
grading1to10 | 1–10 number scale | Value between 1 to 10 |
grading0to10 | 0–10 dropdown | Value between 0 to 10 |
nps | Net Promoter Score (0–10) | Value between 0 to 10 |
emailInput | Valid email required | Must match email regex |
select | Single-select dropdown | Must match option ID |
radio | Radio buttons | Must match option ID |
checkbox | Multi-select checkboxes | Must match option IDs |
textInput | Single-line input | Check length |
textArea | Multiline input | No validation |
Conditional display logic
Each component has a isVisible()
method which would be set to true/false automatically based on the conditions defined on the command center side.
Known limitations
- Media capture such as audio and video upload is not supported
- Currently no support for push notifications (local or server)
- Custom parameter pipe-in is not available
- CloseEnagagement is not supported
- Seeing custom survey views in the Preview app is not supported
- The current health check report does not support Custom Survey View.
Available HealthCheck events:
- Invite triggered
- Invite shown
- Invite deferred
- Invite declined
- Form triggered