Select Page
View Categories

Pollfish

< 1 min read

Pollfish Native plugin wrapper

GitHub Source Code: https://github.com/pollfish/cordova-plugin-pollfish


Requires Cordova plugin: 
com.pollfish.cordova_plugin


Supported Platforms #

  • Android
  • iOS

Usage #


this.pollfish.init(false, false, 'YOUR_API_KEY', 1, 8, 'REQUEST_UUID', false);

this.pollfish.initWithUserAttributes(false, false, 'YOUR_API_KEY', 1, 8, 'REQUEST_UUID', false, {
 'gender': '1',
 ...
});

this.pollfish.showPollfish();

this.pollfish.hidePollfish();

// Event Listeners

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyReceived, (surveyInfo) => {
 console.log("Survey Received: " + JSON.stringify(surveyInfo));
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyCompleted, (result) => {
 console.log("Survey Completed: " + JSON.stringify(surveyInfo));
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishUserNotEligible, (_) => {
 console.log("Pollfish User Not Eligible");
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyNotAvailable, (_) => {
 console.log("Pollfish Survey not available");
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishOpened, (_) => {
 console.log("Pollfish Survey panel is open");
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishClosed, (_) => {
 console.log("Pollfish Survey panel is closed");
});

this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishUserRejectedSurvey, (_) => {
 console.log("Pollfish User Rejected Survey");
});