The in-app message feature offers helpful tools for designing a straightforward survey for mobile users.
Here are some steps you can follow to create a survey like this.
Using a pre-defined template:
1. Choose an in-app message template
You can also use the visual builder or HTML editor to design your own custom in-app message from the ground up. This topic will be discussed in more detail later in this article.
Important: To display native in-app messages built using the rich editor, your app must use one of the following minimum SDK versions: Android SDK 4.2.0 or iOS SDK 3.2.0.
2. Use a CTA button to track responses
The SDK automatically tracks banner events for in-app messages, together with the action event property. The action will be recorded as click, indicating that the user clicked the action button within the in-app message. This event will also include the related text and link properties.
To track how users interact when they click the CTA button, you can add some text to the button that will then be recorded within the event property text.
For more information, please read our in-app messages tracking documentation.
After you complete this setup, you'll be able to see that the button text is linked to the event under the property. text.
3. Add the survey question
You've successfully recorded the user's response, but every survey needs questions. To capture the question for the survey, you can include it as the name/title of the in-app, which will then be tracked under the banner_name attribute in the event.
To close and track the in-app after the user selects an answer, simply select the "Cancel" option in the button settings of the editor.
In this example, you'll add two buttons: Yes and No, to the question, Would you recommend our app to a friend?
Once you finish the setup, the survey name will be tracked under the property banner_name. The in-app closes after the user selects a response, and the answer is recorded in the text property.
Great! Now you've created a straightforward survey using the in-app message template.
Using the Visual Builder:
1. Create a custom template using the Visual Builder
To create a custom template for our survey using the visual builder, simply click "Create new" in-app personalization. Here you can select the Visual Builder.
Important: Android SDK up to version 4.0.1 only recognizes the first button with action type "close" as close button. Any additional buttons with action type "close" will have default link behavior. iOS SDK as well as Android SDK versions later than 4.0.1 support multiple close buttons.
2. Add buttons with data-actiontype set to close
To track the answer, you can add and use the button in the same way as described in the section above, "Use a CTA button to track responses." However, setting this up as a cancel button requires a slightly different approach.
To mark it as a cancel button, scroll down in the editor, navigate to the Attributes > Configure Attributes section, and select Add new attribute.
Then select the data-actiontype option.
Set this option to 'close', so that the button will close the in-app after being clicked.
That's it! You've created a simple survey using the in-app visual editor!
Using the HTML editor:
1. Create a custom template using the HTML editor
Creating a simple in-app survey is easy with the HTML editor. Simply start by creating a new HTML builder template.
2. Add HTML buttons with data-actiontype set to close
Rather than choosing pre-made buttons as you did in the visual builder, let's create our own from scratch. In the HTML editor, you can add buttons using HTML. To make sure the app closes when a user clicks the button, you need to change the button's behavior by adding the optional attribute data-actiontype with the value close.
<div class="button"> <div data-actiontype="close" style="insert your CSS styling here"><span style="word-break: break-word; font-size: 14px; line-height: 200%;">Action</span></div> </div>
close You can customize your in-app message however you prefer using the HTML editor.
Once you finish the setup of our HTML button, the in-app should close after the user selects a response, and the answer will be recorded in the text property.
Gather feedback and engage with users
In conclusion, using in-app messages for simple surveys is an effective way to gather feedback and engage with users. With options like native templates, visual builders, and HTML editors, you can easily create surveys that seamlessly integrate with your app's design and user experience. This guide has now equipped you with the knowledge to make these on your own.