zonkafeedback_sdk 1.1.9
zonkafeedback_sdk: ^1.1.9 copied to clipboard
A Flutter plugin for seamless feedback collection and management with Zonka Feedback.
Zonka Feedback Flutter SDK #
Pre-Requisites #
The Zonka Feedback Flutter SDK requires:
- Zonka Feedback Account: An active Zonka Feedback account.
- SDK Token: Obtain this token for the survey you want to implement:
- Create a Zonka Feedback account.
- Create a new survey with the desired questions.
- Navigate to the Distribute menu → In-App tab.
- Enable the toggle to view your SDK token.
Follow the steps below to integrate the SDK into your app.
Learn more about creating surveys on Zonka Feedback.
Minimum Requirements #
- Flutter: Version 3.0.0 or higher.
- Android:
- CompileSdk version: 34 or higher.
- Android Gradle Plugin: 8.1.0 or higher.
- iOS: iOS 14 or higher.
Installation #
Add the Zonka Feedback SDK as a dependency in your pubspec.yaml
file:
dependencies:
zonkafeedback_sdk: <latest_version>
Configuration #
Configuration for iOS : Add the following snippet to your Info.plist file.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Initialization #
Initialize the SDK in your app's main file (e.g., lib/main.dart
):
import 'package:zonkafeedback_sdk/zonkafeedback_sdk.dart';
class _ZonkaFeedBackSurveyState extends State<ZonkaFeedBackSurvey> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
ZFSurvey().init(
token: ['{{SDK_TOKEN}}'], // Replace with your SDK token
zfRegion: '{{REGION}}', // Options: US, EU, IN
context: context,
minimumHeight: 410,
closeIconPosition: "right",
expandedHeight: 580,
autoClose:false
);
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
ZFSurvey().sendAppLifecycleState(state);
super.didChangeAppLifecycleState(state);
}
}
Survey Display Configuration options #
To configure the display type for the survey, use one of the following options with displayType
:
-
popup
- Shows the survey as a popup in the center of the screen.
-
slide-up
- Displays the survey as a slide-up bottom sheet.
Survey Height Configuration #
-
minimum-height
- You can give minimum height to survey ui slide-up and popup using key
minimumHeight
.
- You can give minimum height to survey ui slide-up and popup using key
-
expanded-height
- You can give maximum height to survey ui slide-up and popup using key
expandedHeight
.
- You can give maximum height to survey ui slide-up and popup using key
Auto Close #
To configure the auto close icon for the survey, use one of the following options with autoClose
:
-
autoClose
- You can set autoClose
true
which enable survey to close automatically..
- You can set autoClose
-
autoClose
- You can set autoClose
false
which disable survey to close automatically.
- You can set autoClose
Close Icon Position #
To configure the close icon for the survey, use one of the following options with closeIconPosition
:
-
left
- You can give position to close icon to left by using value
left
.
- You can give position to close icon to left by using value
-
right
- You can give position to close icon to right by using value
right
.
- You can give position to close icon to right by using value
Setup #
To configure and start the survey in your app:
import 'package:zonkafeedback_sdk/zonkafeedback_sdk.dart';
ZFSurvey().startSurvey();
Optional Parameters #
1. Send Device Details #
Send device details (OS, version, IP address, device type) with responses. Enabled by default.
ZFSurvey().sendDeviceDetails(true);
2. Send Custom Attributes #
Add additional data (e.g., screen name, order ID) to responses.
Map<String, String> properties = {
'property1': 'value1',
'property2': 'value2',
};
ZFSurvey().sendCustomAttributes(properties);
Identifying Logged-In Visitors #
Identify users by passing their details like name, email, mobile, or unique ID:
Map<String, dynamic> properties = {
'contact_name': 'Robin James',
'contact_email': 'robin@example.com',
'contact_uniqueId': '1XJ2',
'contact_mobile': '+14234XXXX',
};
ZFSurvey().userInfo(properties);
Reset Visitor Attributes #
Clear visitor data on logout:
ZFSurvey().clear();