flutter_pollfish 0.1.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 58

flutter_pollfish #

A plugin for Flutter that supports rendering surveys using Pollish SDKs.

Note: This plugin is in beta, and may still have a few issues and missing APIs.

Initializing the plugin #

The Pollfish plugin must be initialized with a Pollfish API Key. You can retrieve an API key from Pollfish Dashboard when you sign up and create a new app.

FlutterPollfish.instance.init(apiKey: 'YOUR_API_KEY')

Other Init params (optional) #

During initialization you can pass different optional params:

  1. pollfishPosition: int - TOP_LEFT=0 , BOTTOM_LEFT=1, TOP_RIGHT=2, BOTTOM_RIGHT=3, MIDDLE_LEFT=4, MIDDLE_RIGHT=5 (defines the side of the Pollish panel, and position of Pollish indicator)
  2. indPadding: int - Sets padding (in dp) from the top or bottom according to Position of the indicator
  3. debugMode: bool - Sets Pollfish SDK to Debug or Release mode. Use Developer mode to test your implementation with demo surveys
  4. customMode: bool - Initializes Pollfish in custom mode (used when implementing a Rewarded approach)
  5. requestUUID: String - Sets a unique id to identify a user. This param will be passed backthrough server-to-server callbacks

Debug Vs Release Mode #

You can use Pollfish either in Debug or in Release mode.

  • Debug mode is used to show to the developer how Pollfish will be shown through an app (useful during development and testing).
  • Release mode is the mode to be used for a released app (start receiving paid surveys).

init Vs custom init #

  • custom mode = false is the standard way of using Pollfish in your apps. Using init function with custom mode disabled, enables controlling the behavior of Pollfish in an app from Pollfish panel.

  • custom mode = true ignores Pollfish behavior from Pollfish panel. It always skips showing Pollfish indicator (small Pollfish icon) and always force open Pollfish view to app users. This method is usually used when app developers want to incentivize first somehow their users before completing surveys to increase completion rates.

For example:

FlutterPollfish.instance.init(
     apiKey: 'YOUR_API_KEY',
     pollfishPosition: 5,
     indPadding: 40,
     customMode: false,
     debugMode: true,
     requestUUID: 'USER_INTERNAL_ID');

Manually showing or hiding Pollfish panel #

During the lifetime of a survey, publisher can manually show or hide survey panel by calling the following functions.

FlutterPollfish.instance.show();

or

FlutterPollfish.instance.hide();

Listening to Pollish notifications #

Publishers can register and receive notifications on different events during the lifetime of a survey

Pollfish Survey Received notification #

Once a survey is received, Pollish Survey Received notification is fired to inform the publisher. The notification includes several info around the survey such as:

  • CPA: money to be earned in USD cents
  • LOI: length of the survey is minutes
  • IR: incidence rate (conversion)
  • Survey Class: survey provider (Pollish, Toluna, Cint etc)
FlutterPollfish.instance.setPollfishReceivedSurveyListener(onPollfishSurveyReveived);

void onPollfishSurveyReveived(String result) => setState(() {

    List<String> surveyCharacteristics = result.split(',');

     if (surveyCharacteristics.length >= 4) {
       String _logText =
              'Survey Received: - SurveyInfo with CPA: ${surveyCharacteristics[0]} and IR: ${surveyCharacteristics[1]} and LOI: ${surveyCharacteristics[2]} and SurveyClass: ${surveyCharacteristics[3]}';
    }
 });

Pollfish Survey Completed notification #

Once a survey is completed, Pollish Survey Completed notification is fired to inform the publisher. The notification includes several info around the survey such as:

  • CPA: money to be earned in USD cents
  • LOI: length of the survey is minutes
  • IR: incidence rate (conversion)
  • Survey Class: survey provider (Pollish, Toluna, Cint etc)
FlutterPollfish.instance.setPollfishCompletedSurveyListener(onPollfishSurveyCompleted);

void onPollfishSurveyCompleted(String result) => setState(() {

    List<String> surveyCharacteristics = result.split(',');

     if (surveyCharacteristics.length >= 4) {
       String _logText =
              'Survey Completed: - SurveyInfo with CPA: ${surveyCharacteristics[0]} and IR: ${surveyCharacteristics[1]} and LOI: ${surveyCharacteristics[2]} and SurveyClass: ${surveyCharacteristics[3]}';
    }
 });

Pollfish Survey Panel Opened notification #

A notification that informs that Pollfish Survey panel opened

FlutterPollfish.instance.setPollfishSurveyOpenedListener(onPollfishSurveyOpened);

void onPollfishSurveyOpened() => setState(() {

   String _logText = 'Survey Panel Open';
}

Pollfish Survey Panel Closed notification #

A notification that informs that Pollfish Survey panel closed

FlutterPollfish.instance.setPollfishSurveyClosedListener(onPollfishSurveyClosed);

void onPollfishSurveyClosed() => setState(() {

   String _logText = 'Survey Panel Closed';
}

Pollfish Survey Not Available notification #

A notification that informs that no survey is available for that user

FlutterPollfish.instance.setPollfishSurveyNotAvailableSurveyListener(onPollfishSurveyNotAvailable);

void onPollfishSurveyNotAvailable() => setState(() {

   String _logText = 'Survey Not Available';
}

Pollfish User Reject Survey notification #

A notification that informs that the user rejected the survey

FlutterPollfish.instance.setPollfishUserRejectedSurveyListener(onPollfishUserRejectedSurvey);

void onPollfishUserRejectedSurvey() => setState(() {

   String _logText = 'User Rejected Survey';
}

Pollfish User Not Eligible notification #

A notification that informs that the user got screened out from the survey

FlutterPollfish.instance.setPollfishUserNotEligibleListener(onPollfishUserNotEligible);

void onPollfishUserNotEligible() => setState(() {

   String _logText = 'User Not Eligible';
}

Following the rewarded approach #

An example is provided on Github that demonstrates how a publisher can implement the rewarded approach. Publisher has to initialize Pollish in custom mode = true and immediately after the the init function to call Pollish hide. When a survey is received, the publisher can show a custom prompt, to incentivize user to participate to the survey. If the user clicks on the prompt, the publisher can call Pollish show to show the questioanniare. Upon survey completion, the publisher can reward the user.

Limitations / Minimum Requirements #

This is just an initial version of the plugin. There are still some limitations:

  • You cannot pass custom attributes during initialization
  • No tests implemented yet
  • Minimum iOS is 9.0 and minimum Android version is 17

For other Pollfish products, see Pollfish docs.

Getting Started #

If you would like to review an example in code please review the Github project.

0.1.0 #

  • Initial Release of Pollfish flutter plugin

0.1.1 #

  • Fixed formatting

0.1.2 #

  • Updating Readme

0.1.3 #

  • Added GitHub repo in pubspec

example/README.md

flutter_pollfish_example #

Demonstrates how to use the flutter_pollfish plugin.

For help getting started with Flutter Pollfish, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_pollfish: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_pollfish/flutter_pollfish.dart';
  
Version Uploaded Documentation Archive
0.1.3 Jan 17, 2019 Go to the documentation of flutter_pollfish 0.1.3 Download flutter_pollfish 0.1.3 archive
0.1.2 Jan 16, 2019 Go to the documentation of flutter_pollfish 0.1.2 Download flutter_pollfish 0.1.2 archive
0.1.1 Jan 16, 2019 Go to the documentation of flutter_pollfish 0.1.1 Download flutter_pollfish 0.1.1 archive
0.1.0 Jan 16, 2019 Go to the documentation of flutter_pollfish 0.1.0 Download flutter_pollfish 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
16
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1
  • Flutter: 1.2.1

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8