Flutter

Overview

The Blitzllama Flutter SDK allows you to deliver in-app surveys seamlessly within your Flutter application. By integrating the SDK, you can collect targeted user feedback during critical moments in the user journey.

Key Features

  • Quickly embed surveys via configurable triggers.

  • Identify and track users to avoid duplicate surveys.

  • Personalize surveys using user attributes and event properties (optional).

  • Localize surveys by setting preferred languages (optional).

Requirements

  • Access to the Blitzllama dashboard for API key retrieval and trigger configuration.


Getting Started

Before You Begin

  1. Obtain Your API Key: Log in to the Blitzllama dashboard, navigate to the Connections tab, select Flutter, and retrieve your API key.

  2. Confirm Compatibility: Ensure your Flutter project is set up and running.

Quick Start (10 Minutes)

  1. Open your pubspec.yaml file and add the following dependency:

dependencies:
    blitzllama_flutter: ^0.6.2
  1. Run the command:

flutter pub get
  1. Import Blitzllama in your Dart code:

import 'package:blitzllama_flutter/blitzllama_flutter.dart';
  1. Initialize the SDK: Add the initialization code in the file where Blitzllama functions will be invoked:

BlitzllamaFlutter.init("<api_key>");

If you face issues with iOS builds, add the following to your Podfile:

target 'Runner' do
  use_frameworks!
  pod 'SwiftyJSON'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

Check pub.dev for usages and examples.

Managing Users

  1. Create a User: Create a unique user ID to ensure consistency and avoid multiple surveys for the same user

BlitzllamaFlutter.createUser(user_id);
  1. Update User Email (Optional): You can associate an email address with the user

BlitzllamaFlutter.setUserEmail(email)
  1. Update User Name (Optional): Personalize surveys by associating a user name

BlitzllamaFlutter.setUserName(username)
  1. Set User Attributes (Optional): Add user attributes for targeting specific cohorts

BlitzllamaFlutter.setUserAttribute(attribute, attributeValue, dataType); 

Allowed data_type values are "string", "number", "date", and "boolean".

  1. Set Survey Language (Optional): Define the preferred survey language in ISO 639-1 codes.

BlitzllamaFlutter.setSurveyLanguage("en");
  1. Logout User (Optional): Clear the user session by calling

BlitzllamaFlutter.logout();

Adding Triggers

  1. Triggering a Survey: Add triggers to initiate surveys at key moments (e.g., button press or page load)

BlitzllamaFlutter.triggerEvent(triggerName);
  1. Adding Event Properties (Optional): Attach properties to a trigger for advanced targeting

 BlitzllamaFlutter.triggerEvent(triggerName, eventProperties); 
 //Example: {"age": 20}

These properties can be used to segment and target users based on context, which can be configured in the Blitzllama dashboard.

FAQ & Troubleshooting

  1. Survey not showing up?

    1. Ensure createUser is called before triggerEvent.

    2. Verify that the event name matches the Blitzllama dashboard configuration.

  2. Survey not appearing on app launch?

    1. Add a callback to the createUser function to handle potential race conditions:

BlitzllamaFlutter.createUser(user_id, onSuccess: () {
  BlitzllamaFlutter.triggerEvent("trigger_name");
});
  1. Switching users?

    1. Call logout() before creating a new user.

  2. How to create triggers?

    1. Add a new trigger_name in your app; it will automatically sync with the Blitzllama dashboard.

    2. Alternatively, configure the trigger in the Blitzllama dashboard first, then use it in your app.

Next Steps

  1. Start by adding triggers for the top 5 critical user actions in your app.

  2. Create your first survey on the Blitzllama dashboard.

  3. Customize the survey UI/UX on the dashboard to align with your brand.

For additional support, reach out via support chat or email at tech@blitzllama.com.

Last updated