Survicate Flutter SDK
Requirements
- Using Survicate Mobile SDK requires an account at survicate.com. You can create your account here for free, or become invited to your company account by one of your colleagues.
- Additionally, please check iOS and Android library requirements, as they're applicable too.
Installation
To use this plugin, add survicate_sdk
as a dependency in your pubspec.yaml file.
Configuration
Configuration for Android
- Configure your workspace key in
AndroidManifest.xml
file.
- Add the Survicate Maven repository to your project
build.gradle
located underandroid
directory.
Configuration for iOS
- Add workspace key to your
Info.plist
file.- Create
Survicate
Dictionary. - Define
WorkspaceKey
String inSurvicate
Dictionary. YourInfo.plist
file should looks like this:
- Create
- Run
pod update
in yourios
directory.
Initialization
Initialize the SDK in your application using initializeSdk()
method. Call this method only once, in the main component (e.g lib/main.dart
file).
Using SDK
Survicate allows you to launch precisely targeted surveys inside your app. In the Survicate Panel, you can set conditions that need to be met for the surveys to appear. Users matching conditions defined in the Survicate panel will see the survey automatically. Here's a list of conditions you can use to target your surveys:
- Name of the screen that a user currently sees
- Any application event
- User attributes and identities
- Language of the device
- Operating system
Make sure to list all the screens and events described in your application. Once you got this covered, you or any person responsible for creating and managing surveys will be able to trigger surveys from the Survicate panel with no need for you to update the application.
Targeting a survey by screen name
A survey can appear when a user is viewing a specific screen. For example, a survey can be triggered to show up on the application's home screen after a user spends more than ten seconds there. To set it up, you need to send information to Survicate about the user entering and leaving a screen.
Note: Multiple active screens are allowed. In specific, calling enterScreen() does not make the previous screen to be discarded. Be sure to call leaveScreen() when you no longer want the screen to be treated as active.
Screen name is case sensitive. If there's any discrepancy between what's declared in the ‘Screens’ tab of the Target section in the Survicate panel and the application code, the survey will not appear.
Events-based survey targeting
The SDK allows you to launch surveys based on events your users trigger in your app. Your survey will show instantly after an event occurs in your app.
Event name and property keys are case sensitive. If there is any discrepancy between what's declared in the ‘Triggers’ tab of the Target section in the Survicate panel and the application code, the survey will not appear.
Passing user attributes
You can provide user attributes to Survicate as an extra layer of information about your users. The attributes have various use cases:
- Identification of survey participants (answers are anonymous by default).
- Directing surveys to particular users (Audience filters).
- Filtering responses.
- Recalling data in questions.
Bear in mind that user attributes are cached. You only need to provide them once, e.g. when user logs in, not after each initilization. You can also change their values at any time to trigger a survey.
Attribute types
- string: any text.
- num: an integer or decimal.
- bool: a logic value.
- dateTime: a dart:core
DateTime
object which can be used with date or time interval filters in the panel (the latter measure elapsed time from a given timestamp).
Special attributes
-
user_id: This corresponds to the "Logged-in status" in the panel's Audience filter. A user is considered logged-in when a trait with the "user_id" key has been set on the device, regardless of the value.
-
first_name, last_name, email: If none of these is specified, a response will be marked as Anonymous in the panel.
Additional notes
You can set your own attribute keys without any prior registration. They will show up in the panel once any response with the attribute is uploaded.
Reseting user data for testing purposes
If you need to test surveys on your device, reset()
method might be helpful. This method will reset all user data stored on your device (survey views, attributes, information about answered surveys for the targeting engine).
Event listeners
SDK allows you to utilize event listeners. You may find them useful to trigger actions in your application based on actions performed by respondents. Here's a list of events you can subscribe to:
- onSurveyDisplayed - occurs when survey is loaded and appears in the User Interface
- onQuestionAnswered - occurs after a question is answered ( Survicate stores incomplete survey submissions )
- onSurveyClosed - occurs when a user closes the survey using the close button
- onSurveyCompleted - occurs when a user finishes the survey
SurvicateAnswer properties (QuestionAnsweredEvent.answer)
Property | Type | Description |
---|---|---|
type | String? | Answer type. One of: ['text', 'single', 'multiple', 'smiley_scale', 'rating', 'csat', 'numerical_scale', 'nps', 'date', 'form', 'matrix', 'button_close', 'button_next', 'button_link']. |
id | int? | Answer ID. Applicable only for types: ['single', 'smiley_scale', 'csat', 'rating', 'numerical_scale']. |
ids | List<int> | Selected answer IDs. Applicable only for type = ['multiple']. |
value | String? | Text representation of an answer, e.g. "Happy" for smiley scale. Not applicable for call-to-action answers: ['button_close', 'button_next', 'button_link']. |
The id
, ids
and value
properties are provided only for the cases enlisted in the table above. Therefore, expect that there might be answer objects that consist only of the type
property.
Changelog
5.3.0 (2024-09-13)
- New
- Once an event is invoked in the app, its name and property names are also sent to Survicate’s panel now. They will be shown as suggestions when a user configures event targeting of a survey.
5.2.0 (2024-09-05)
- New
- New conditions are available in event targeting:
Time delay after event occurrence
Number of event occurrences
Time of the first occurrence
Time of the last occurrence
If multiple conditions are applied, all of them should be met for a survey to appear. - Updated
- Bumping up reference of Android to 5.2.0.
Bumping up reference of iOS to 5.2.0. - Fixed
- Fixed an issue with submit button visibility in single choice question on iOS.
5.1.1 (2024-08-01)
- Updated
- Bumping up reference of Android to 5.1.1.
Bumping up reference of iOS to 5.1.2. - Improved
- More distinguishable emojis in the 3-choice Smiley scale.
- Fixed
- Excessive spacing between Smiley scale emojis in the 3-choice layout.
Back button icon color on dark backgrounds on Android.
An issue on Android where "Submit" was displayed instead of "Start Survey" on the welcome CTA point after navigating back to it.
Issue on iOS with non visible Submit button in multiple choice questions.
5.1.0 (2024-07-19)
- New
- Navigation buttons are available now. When enabled, your survey respondents can go back to the previous questions, see their selected answers, and change them if necessary.
- Improved
- Higher resolution of Smiley scale icons on Android.
- Updated
- Bumping up reference of Android to 5.1.0.
Bumping up reference of iOS to 5.1.1. - Fixed
- Propagating Matrix answer in
SurvicateAnswer.value
of event listener.
An issue on Android that resulted in unexpected vertical padding for Matrix question in full screen mode.
Configuration json will be printed in console only in verbose log level on iOS.
5.0.0 (2024-06-19)
- New
- Matrix question type added.
- Updated
- Bumping up reference of Android to 5.0.0.
Bumping up reference of iOS to 5.0.0. - Fixed
- UI state bugs related to Activity's configuration changes.
Animation resource names that could conflict with resources of the app or other libraries on Android.
An issue on iOS wheresetUserTraits
cleared previously set user traits.
4.4.0 (2024-05-09)
- New
- New targeting option available - event properties. You can add multiple properties to one event and join them with either “or” or “and” operator.
Property names and values are case-sensitive. Only string values are supported.
SDK now supports listeners. - Updated
- Bumping up reference of Android to 4.4.0.
Bumping up reference of iOS to 4.4.0. - Fixed
- A bug in Android that could prevent a survey from being displayed if a delay was set for multiple screens in the panel.
Horizontal mode support for Numerical Rating question for up to 5 items in Android.
4.3.0 (2024-03-26)
- New
- More flexible survey recurring options are available now. Now you can specify how many days / weeks / months / years should pass before the survey can appear again. It’s also possible to set after how many days / weeks / months / years the survey should stop recurring.
If you run several mobile surveys, now you can use survey throttling settings to specify a time frame that should pass between showing them. Use global throttling to set the same time frame for all your mobile surveys. Or use the survey level throttling to override the global settings and specify a different period before showing a particular survey. - Updated
- Bumping up reference of Android to 4.3.0.
Bumping up reference of iOS to 4.3.0. - Fixed
- Issue with recursive display of non-recurring survey on iOS.
4.2.0 (2024-03-20)
- New
- New targeting filter is available - screen orientation (portrait mode or landscape mode targeting). You can either include or exclude one of the orientation modes.
- Updated
- Bumping up reference of Android to 4.2.0.
Bumping up reference of iOS to 4.2.0. - Improved
- Performance enhancements in answers synchronization on Android.
- Fixed
- An issue where SurveyActivity could crash when it was restored after process termination on Android.
A race condition in the recalling feature on Android.
4.0.1 (2024-01-23)
- Updated
- Bumping up reference of Android to 4.0.2.
Bumping up reference of iOS to 4.0.2. - Improved
- Date format in user traits recalling
- Fixed
- A bug where users could see survey more times than specified in recurrence settings if SDK was updated in meantime
Sending user attributes to backend only when necessary in Android
An issue where Thank you screen don't close survey in classic theme in iOS
4.0.0 (2024-01-09)
- New
- User conditions targeting is changed to the audience targeting: create an audience that will be available for usage among all your mobile surveys. Enable multiple audiences at the same time in one survey if necessary
User attributes now support not only string values but also numbers, boolean, and datetime values
New attribute operators are available to support new data types
Survey audience can be set not only by including a set of respondents who met the required criteria but also by excluding those who should not see the survey
And / or operators in audience targeting are switchable now: within one attribute filter that has several attributes in it and between different filters - Breaking
- Method
setUserTrait
now takes singleUserTrait
argument instead of two String arguments.
MethodsetUserTraits
now takesList<UserTrait>
argument instead ofMap<String, String>
argument. - Updated
- Bumping up reference of Android to 4.0.1.
Bumping up reference of iOS to 4.0.0
UseNetworkCapabilities
to check internet connection (API 24+)
Migrate toWindowCompat
APIs for setting full screen background - Fixed
- Fixed invalid survey closing when app has specified
android:enableOnBackInvokedCallback="true"
in the AndroidManifest.xml
3.0.5 (2023-12-14)
- Updated
Bumping up references: Android to 3.0.6.
AGP to 8.1.2.
Kotlin to 1.9.10.
AndroidX RecyclerView to 1.3.2.
Creating User Trait requires non null key.
Added a Proguard rule for User Traits.- Fixed
Issue on Android with saving User Traits that could cause crash whenever saved User Trait key was null.
Issue on Android where answers saved without internet were not synchronized in next app sessions.
Issue on Android with javadoc generation.
3.0.4 (2023-10-02)
- Fixed
Bumping up references: Android to 3.0.4 and iOS to 3.0.4
Issue on iOS where surveys were not translated when app language was set to dialect.
Issue on iOS where rating scale question answer ID was missing in listener.
On Android, added image scaling to shapes rating questions to fit all answers on the screen in horizontal layout.
Issue on Android on Thank You question with button's title not using text from survey settings.
Issue on Android where in some cases survey was not dismissible.
3.0.2 (2020-09-19)
- New
First version of the SDK, with references to the native Survicate SDKs version 3.0.2.