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

  1. Configure your workspace key in AndroidManifest.xml file.
  1. Add the Survicate Maven repository to your project build.gradle located under android directory.

Configuration for iOS

  1. Add workspace key to your Info.plist file.
    • Create Survicate Dictionary.
    • Define WorkspaceKey String in Survicate Dictionary. Your Info.plist file should looks like this: Info.plist example
  2. Run pod update in your ios 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 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 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).

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.

  • If you set a trait with "user_id" key, it will correspond to known user concept in the panel's Audience, allowing you to set up a built-in Known user filter. A user is considered known when there is any trait with the "user_id" key.

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).


Changelog

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 single UserTrait argument instead of two String arguments.
Method setUserTraits now takes List<UserTrait> argument instead of Map<String, String> argument.
Updated
Bumping up reference of Android to 4.0.1.
Bumping up reference of iOS to 4.0.0
Use NetworkCapabilities to check internet connection (API 24+)
Migrate to WindowCompat 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.