flutter_survey_intercept 0.1.8-beta.1 copy "flutter_survey_intercept: ^0.1.8-beta.1" to clipboard
flutter_survey_intercept: ^0.1.8-beta.1 copied to clipboard

Flutter plugin for QuestionPro CX survey intercept. Enables rule-based in-app surveys on Flutter mobile apps.

flutter_survey_intercept #

A Flutter plugin for QuestionPro CX SDK integration, enabling survey intercept functionality on iOS and Android platforms.

Features #

  • Seamless integration with QuestionPro CX SDK
  • Survey intercept capabilities for mobile applications
  • Cross-platform support (iOS 14.0+ and Android)
  • Native bridge implementation for both platforms

Getting started #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_survey_intercept: ^0.1.8

Then run:

flutter pub get

Android Configuration #

1. Add JitPack Repository

In your app's android/settings.gradle, add JitPack to the repositories:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }  // Required for QuestionProCX SDK
    }
}

Legacy projects: If your project uses android/build.gradle (project level) instead of settings.gradle, add JitPack there:

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

2. Configure AndroidManifest.xml

Add the following permissions and API key to your android/app/src/main/AndroidManifest.xml if not already added:

<uses-permission android:name="android.permission.INTERNET"/>

Note: Most manifest merger conflicts are already handled by the plugin. If you still encounter issues, add xmlns:tools="http://schemas.android.com/tools" to your <manifest> tag and tools:replace="android:label" to your <application> tag.

iOS Configuration #

The plugin supports two approaches for iOS dependency resolution:

SPM is the recommended approach. The plugin's Package.swift automatically resolves QuestionProCXFrameworkno Podfile changes needed.

Enable SPM for your Flutter project (one-time setup):

flutter config --enable-swift-package-manager

Then run:

flutter pub get

Flutter will resolve the QuestionProCXFramework dependency automatically when you build.

Important: Your app's iOS deployment target must be set to 14.0 or higher in Xcode — not just in the Podfile. Open ios/Runner.xcworkspace → select the Runner target → GeneralMinimum Deployments → set iOS to 14.0.

Option B — CocoaPods

If your project uses CocoaPods, add the QuestionPro CX framework to your ios/Podfile inside your app target:

target 'Runner' do
  # ... existing entries
  pod 'QuestionProCXFramework', :git => 'https://github.com/surveyanalyticscorp/ios-cx', :tag => '2.3.0'
end

Then run:

cd ios
pod install
cd ..

Note: When a new version of the iOS SDK is released, update the :tag value and run pod update QuestionProCXFramework.

Usage #

Import the package in your Dart code:

import 'package:flutter_survey_intercept/flutter_survey_intercept.dart';

Basic integration #

  1. Initialize the SDK (for example in your first screen’s initState):
Future<void> initializeSdk() async {
    final result = await FlutterSurveyIntercept.init(
        apiKey: 'YOUR_API_KEY',
        dataCenter: DataCenter.us,
    );
    debugPrint('Initialization result: $result');
}

Set the dataCenter value according to your QuestionPro account's data center (for example, DataCenter.eu for EU accounts, DataCenter.us for US accounts). Supported values include DataCenter.us, DataCenter.eu, DataCenter.ca, DataCenter.au, DataCenter.sg, DataCenter.ae, DataCenter.sa, and DataCenter.ksa.

  1. Track screen visits to drive view-count–based rules:
Future<void> setScreenVisited() async {
    try {
        final result = await FlutterSurveyIntercept.setScreenVisited(
            screenName: 'check_out',
        );
        debugPrint('Screen view logged successfully: $result');
    } catch (e) {
        debugPrint('Error logging screen view: $e');
    }
}
  1. Send custom variables via data mappings (used by targeting rules):
Future<void> setDataMappings() async {
    try {
        final customData = <String, String>{
            'firstName': 'first_name',
            'lastname': 'last_name',
            'email': 'questionpro@example.com',
        };

        final result = await FlutterSurveyIntercept.setDataMappings(
            customVariables: customData,
        );
        debugPrint('Data mappings set successfully: $result');
    } catch (e) {
        debugPrint('Error setting data mappings: $e');
    }
}
  1. Register the survey URL listener (typically in main() before runApp):
void main() {
    // Start listening for survey URLs from the native SDK
    FlutterSurveyIntercept.getSurveyUrlListener();

    // Handle survey URL when rules are satisfied
    FlutterSurveyIntercept.getSurveyUrl = (url) {
        debugPrint('Survey URL received: $url');
        // TODO: Open this URL in a WebView or browser
    };
}

When the configured rules (view count, data mappings, etc.) are satisfied, the SDK will invoke your FlutterSurveyIntercept.getSurveyUrl callback with the survey URL, which you can present to the user.

Additional information #

This plugin integrates the QuestionPro CX SDK for survey intercept capabilities in Flutter applications.

For issues or questions, please contact the package maintainer.

0
likes
0
points
144
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for QuestionPro CX survey intercept. Enables rule-based in-app surveys on Flutter mobile apps.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_survey_intercept

Packages that implement flutter_survey_intercept