Comment on page
Flutter
Setting up Blitzllama for your Flutter app is easy and you can do it by following the steps. The complete SDK integration into a Flutter app takes an average of 10 mins.
The three main sections here are:
- Integrating the SDK: retrieving and adding the SDK to your project
- Managing Users: creating a new user and setting user attributes
- Adding Triggers: add triggers in critical components inside your app to initiate the micro-surveys
Open
pubspec.yaml
and add the following dependencies:dependencies:
blitzllama_flutter: ^0.4.0
Next, open the terminal window then run the command
flutter pub get
import 'package:blitzllama_flutter/blitzllama_flutter.dart';
..
..
.
.
BlitzllamaFlutter.init("<api_key>");
Please add the above line to the file to which Blitzllama functions are added.
In case you face issues with iOS builds, Please add below snippet to run frameworks
target 'Runner' do
use_frameworks!
pod 'SwiftyJSON'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
It is mandatory to create users using unique user IDs. Not only does it provide a consistent experience across platforms, but it also prevents users from being surveyed multiple times.
Create a user with a unique user_id to prevent any inconsistencies.
Please clear storage, if you are switching between projects in the same device.
BlitzllamaFlutter.createUser(user_id);
You can provide Blitzllama with the user's email address. Email address is not mandatory for Flutter micro-surveys.
BlitzllamaFlutter.setUserEmail(email)
You can also provide Blitzllama with the user's name. It can be used to make the questions more personalized. The user name is, again, not mandatory to launch surveys.
BlitzllamaFlutter.setUserName(username)
Attributes are additional data points about users, that are used for creating targeted user cohorts on the Blitzllama dashboard. Attributes are optional and not required to launch a micro-survey.
Allowed data_type values are "string", "number", "date", and "boolean".
BlitzllamaFlutter.setUserAttribute(attribute, attributeValue, dataType);
You can provide Blitzllama with the language you wish to survey your user. It is not mandatory to launch surveys.
BlitzllamaFlutter.setLanguageCode("en");
You can call this function if you wish to stop tracking the user.
BlitzllamaFlutter.logout();
Triggers, when initiated, display the micro-survey to the users. You can add triggers to all components - button press, screen open, or screen close - that are critical in a user's journey.
Make sure to create a user before triggering a survey.
BlitzllamaFlutter.triggerEvent(triggerName);
Last modified 14d ago