Link Search Menu Expand Document


Table of contents

  1. Application screens
  2. Events
  3. User traits
  4. Reset
  5. Listeners

Survicate gives you the ability to send targeted surveys to your users within your app in a simple, easy, and fast way for you as well as Survicate application users. Within Survicate Panel you can choose criteria that your users have to meet in order for the surveys to appear in different ways. The users matching the conditions will see the survey automatically. You can set the criteria to be custom user attributes or user events you created.

Available conditions:

  • Screen
  • Event
  • User attributes
  • Language
  • Known user
  • 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 them from Survicate panel with no need for you to update the application.

Application screens

A survey can appear when your application user is viewing a specific screen. As an example, a survey can be triggered to show up on the home screen of the application, after a user spends there more than 10 seconds. To achieve such effect, you need to send information to Survicate about user entering and leaving a screen.

Kotlin Java Swift Objective-C

class PurchaseSuccessActivity : Activity() {

    val SCREEN_NAME = "purchaseSuccess"

    override fun onCreate(savedInstanceState: Bundle?) {
        // ...

    override fun onDestroy() {
public class PurchaseSuccessActivity extends Activity {

    public static final String SCREEN_KEY = "purchaseSuccess";

    protected void onCreate(@Nullable Bundle savedInstanceState) {
        // ...

    protected void onDestroy(){

class PurchaseSuccessViewController: UIViewController {

    static var SCREEN_KEY: String = "purchaseSuccess"

    override func viewWillAppear(_ animated: Bool) {

    override func viewWillDisappear(_ animated: Bool) {

@implementation PurchaseSuccessViewController

- (void)viewWillAppear:(BOOL)animated {  
  [super viewWillAppear:animated];
  [[Survicate shared] enterScreenWithValue:@"purchaseSuccess"];

-(void)viewWillDisappear:(BOOL)animated {  
  [super viewWillDisappear:animated];  
  [[Survicate shared] leaveScreenWithValue:@"purchaseSuccess"];  



You can log custom user events throughout your application. They can later be used in Survicate panel to trigger your surveys. Events trigger surveys instantly after ocurring in your app.

Kotlin Java Swift Objective-C

button.setOnClickListener {
purchaseBtn.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
        // ...
@IBAction func didPressButton(_ sender: Any) {
    Survicate.shared.invokeEvent(name: "userPressedPurchase")
- (IBAction)didPressButton:(id)sender {
    [[Survicate shared] invokeEventWithName:@"userPressedPurchase"];

User traits

You can assign custom attributes to your users. Those attributes can later be used to trigger the survey or even filter the survey results within Survicate panel.

Kotlin Java Swift Objective-C

val traits = ArrayList<UserTrait>()
traits.add(UserTrait("eyes", "blue"))

// or just
List<UserTrait> traits = new ArrayList<>();
traits.add(new UserTrait.UserId("someUserId"));
traits.add(new UserTrait.FirstName("John"));
traits.add(new UserTrait("eyes", "blue"));

// or just
Survicate.setUserTrait(new UserTrait.UserId("someOtherUserId"));
let traits: [UserTrait] = [
    UserTrait(withName: "eyes", value: "blue")
Survicate.shared.setUserTraits(traits: traits)

// or just
[[Survicate shared] setUserTraitsWithNamesAndValues:@{
    @"user_id": @"someUserId",
    @"first_name": @"John",
    @"eyes": @"blue"

// or just
[[Survicate shared] setUserTraitWithName:@"user_id" value:@"someOtherUserId"];

Please keep in mind that user traits are cached, you only have to provide them once, e.g. when user logs in, not after each init(). You can also change their values at any time (which may potentially trigger showing the survey).


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 (views, traits, answers).

Kotlin Java Swift Objective-C

[Survicate.shared reset];


SDK provides a number of listeners that you might find useful to trigger certain actions in your application based on the user’s actions:

  • Survey displayed - occurs when survey gets loaded and appears in user’s interface
  • Question answered - this event is triggered after a response submitted to each question
  • Survey closed - appears after user closes the survey using the close button
  • Survey completed - occurs when user responds to their last question and therefore finishes a survey

Kotlin Java Swift Objective-C

Survicate.setEventListener(object: SurvicateEventListener {
    override fun onSurveyDisplayed(surveyId: String) {
        Toast.makeText(this@MainActivity, "on survey displayed", Toast.LENGTH_SHORT).show()
    override fun onQuestionAnswered(surveyId: String, questionId: Long, answer: SurvicateAnswer) {
        Toast.makeText(this@MainActivity, "on question answered", Toast.LENGTH_SHORT).show()
    override fun onSurveyClosed(surveyId: String) {
        Toast.makeText(this@MainActivity, "on survey closed", Toast.LENGTH_SHORT).show()
    override fun onSurveyCompleted(surveyId: String) {
        Toast.makeText(this@MainActivity, "on survey completed", Toast.LENGTH_SHORT).show()
Survicate.setEventListener(new SurvicateEventListener() {
    public void onSurveyDisplayed(@NonNull String surveyId) {
        Toast.makeText(MainActivity.this, "on survey displayed", Toast.LENGTH_SHORT).show();
    public void onQuestionAnswered(@NonNull String surveyId, long questionId, @NonNull SurvicateAnswer answer) {
        Toast.makeText(MainActivity.this, "on question answered", Toast.LENGTH_SHORT).show();
    public void onSurveyClosed(@NonNull String surveyId) {
        Toast.makeText(MainActivity.this, "on survey closed", Toast.LENGTH_SHORT).show();
    public void onSurveyCompleted(@NonNull String surveyId) {
        Toast.makeText(MainActivity.this, "on survey completed", Toast.LENGTH_SHORT).show();
class YourClassName{
    // ...
        Survicate.shared.delegate = self
    // ...

extension YourClassName: SurvicateDelegate {
    func surveyDisplayed(surveyId: String) {
        print("DELEGATE survey_displayed \(surveyId)")

    func questionAnswered(surveyId: String, questionId: Int, answer: SurvicateAnswer) {
        print("DELEGATE question_answered \(surveyId) \(questionId) \(answer)")

    func surveyCompleted(surveyId: String) {
        print("DELEGATE survey_completed \(surveyId)")

    func surveyClosed(surveyId: String) {
        print("DELEGATE survey_closed \(surveyId)")

@interface AppDelegate () <SurvicateDelegate>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// ...
    [[Survicate shared] initialize];
    [[Survicate shared] setDelegate:self];
// ...

- (void)questionAnsweredWithSurveyId:(NSString * _Nonnull)surveyId questionId:(NSInteger)questionId answer:(SurvicateAnswer * _Nonnull)answer {
    NSLog(@"DELEGATE questionAnsweredWithSurveyId: %@, questionId: %ld, answer: %@", surveyId, (long)questionId, answer);

- (void)surveyClosedWithSurveyId:(NSString * _Nonnull)surveyId {
    NSLog(@"DELEGATE surveyClosedWithSurveyId: %@", surveyId);

- (void)surveyCompletedWithSurveyId:(NSString * _Nonnull)surveyId {
    NSLog(@"DELEGATE surveyCompletedWithSurveyId: %@", surveyId);

- (void)surveyDisplayedWithSurveyId:(NSString * _Nonnull)surveyId {
    NSLog(@"DELEGATE surveyDisplayedWithSurveyId: %@", surveyId);

Note: Our React Native library doesn’t support listeners yet.

SurvicateAnswer object properties

Property Type Description
type string Answer type.
id integer Answer ID. Applicable only for type = [‘single’, ‘smiley_scale’, ‘dropdown_list’].
ids integer[] Array of answer IDs. Applicable only for type = [‘multiple’].
value string Context value of the answer. Applicable only for type = [‘text’, ‘nps’, ‘date’, ‘rating’].

Note: at the moment we support passing the id, ids and value properties only for the cases enlisted in the table above. Therefore, expect that there might be answer objects that consist only of the type property.

← Installation Changelog →

👋 If you bump into any problems or need more support, just start a conversation using Intercom in the bottom-right corner and you will be immediately routed to our Customer Support Engineers.