Surveys
This page explains how to integrate, configure, and validate surveys using the Contentsquare SDK.
Contentsquare mobile surveys enable collection of user feedback through configurable surveys displayed in mobile applications. These surveys capture the voice of your customers, providing valuable insights into how users perceive your app. By analyzing survey responses, you can make informed decisions for site improvements or identify issues you may not have been aware of.
Before you begin
Section titled Before you beginIn order to enable Surveys in your app and get the most stable version, install or upgrade the SDK to its latest version.
If you install the SDK for the first time, these steps are required:
Trigger surveys
Section titled Trigger surveysTriggering surveys allows for a clear separation between survey management and app development:
- Marketing and Product Teams use the Contentsquare platform to create surveys and decide when they should appear by assigning them to a specific trigger (for example,
purchase-complete
). - Developers place these triggers in the application’s code at key moments in the user journey.
This allows your business teams to launch, update, and manage survey campaigns independently, without requiring a new app release.
Step 1: Define and implement triggers
Section titled Step 1: Define and implement triggersYour mobile app can trigger a survey by referencing a predefined trigger name tied to a specific event or behavior.
Contentsquare.triggerSurvey(triggerName: String)
Triggers act as flexible placeholders and are not bound to individual surveys—allowing your business team to assign or update surveys later without requiring code changes.
For example, if you want to collect Net Promoter Score (NPS) feedback after a user completes a purchase:
-
Determine the precise moments in the user journey where you want to collect feedback and define the trigger name, for example
purchase-complete
. -
Implement this trigger right after the purchase completes:
Contentsquare.triggerSurvey("purchase-complete")
When this code is executed, it signals that the “purchase-complete” event has occurred, which in turn displays the corresponding survey to the user.
Step 2: Set up your first test survey
Section titled Step 2: Set up your first test surveyTo validate the integration, start by creating a test survey in the test environment of your application.
- Create and activate a test survey on the Surveys platform by following these steps ↗.
- When creating the survey, assign a test survey trigger — this is the trigger you’ll implement in your application.
Step 3: Validate the integration
Section titled Step 3: Validate the integrationValidate the integration on the test environment of your application.
- Implement the test survey trigger in your application code.
- Launch the app and navigate as an end user to simulate the behavior or event associated with the trigger.
- Confirm that the survey UI appears as expected.
- Check SDK logs to ensure the trigger is recognized. Look for a log entry like:
CSLIB: Will attempt triggering survey
. - After successful validation, deactivate the test survey.
Key considerations
Section titled Key considerations- Surveys can only be triggered and displayed when the device has an active internet connection
- Only one survey can be displayed for a given trigger. If multiple surveys are configured for the same trigger, the SDK will display the one with the most specific matching criteria. If the criteria are identical, the most recently created survey will be shown
Collected data
Section titled Collected dataThe SDK collects the following data related to surveys:
- Survey interaction events (for example, impressions, completion, or close actions)
- Targeting parameters used for displaying surveys, such as the targeting percentage
- Survey responses