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
Survicate Android SDK allows you to launch surveys based on events your users trigger in your app. Your survey will instantly after an event occurs in your app.
Event name is 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 pass user attributes to Survicate as an additional layer of information about your users. Attributes can be used to:
- trigger your surveys
- filter your survey results
Bear in mind that user attributes are cached. You only need to provide them once, e.g. when user logs in, not after each init()
. You can also change their values at any time to trigger a survey.
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).