- Fixed crashes on iOS 14.
v.5.5.1
- Added support for Pollfish Unity Plugin integration with Pods.
v.5.5.0
- Changed packaging to .xcframework
- Added support for arm64 devices
v.5.4.1
- Removed from user attributes the ability to send social ids and other user info aside from demographics
v.5.4.0
- Removed public interfaces for sending location and beacon info
v.5.3.1
- Added a modulemap for Swift interoperability
v.5.3.0
- Added support for iOS 14. Pollfish SDK utilizes the IDFA and therefore it should initialized in iOS 14 only when the IDFA tracking permission is granted by the user.
v.5.2.5
- Added functionality if overlay views are not attached to top view controller, re-attach
v.5.2.4
- Fixed overlay visibilty in modular views in iOS<13
v.5.2.3
- Ensure the Pollfish overlay view is always on top
v.5.2.2
- Added backwards compatibility support for XCode 10.x
v.5.2.1
- Added isPollfishPanelOpen public interface
v.5.2.0
- Fixed issues around panel visibility and concurrency
- Added support for new demographics (spoken languages, organization role, organization number of employees)
v.5.1.0
- Removed deprecated UIWebView functions
v.5.0.0
- Created new expandable interface initWithAPIKey(...) with a configuration PollfishParams object
- Removed old init interfaces
- Removed deprecated interface setAttributes
- Removed customMode and introduced rewardMode option
- Added support for offerwall mode
- Added option to pass a container view to rendered Pollfish overlay
- Removed automatic re-init feature for device orientation
- Added support for exiting faulty mediation surveys
v4.5.1
- Fixed bug with user locale
v4.5.0
- Added support for retrieving survey info in callbacks (CPA, IR, LOI, Survey Class)
v4.4.0
- Added support for iOS 12
- New iOS minimum is 9.0
- Added dependency on WebKit.framework
- Added the ability to render surveys from Mediation within the app
- Added notification for user rejecting a survey
- Improved performance
- Fixed bugs
v4.3.5
- Added ability to test survey formats in debug mode
v4.3.4
- Deprecated destroy function
- Added dynamic caching
- Drastically decreased sdk size
- Updated Pollfish indicator
- Improved performance
- Fixed memory leaks
- XCode 9 support (required)
v4.2.4
- Fixed bitcode issue
v4.2.3
- Added support for sending user attributes during init
- Deprecated setAttributeDictionary function
- Fixed bug for multiple notifications and url encoding
- Fixed isPollfishPresent bug
v4.2.2
- Fixed bug on survey view
v4.2.1
- ATS compliance
- improved performance
v4.2.0
- Fixed bitcode issue
- New API functions to support beacon and location relevant surveys
- Added support for new type of questions in surveys, including video surveys
- Added new framework dependency (SystemConfiguration.framework)
v4.1.2
- Fixed ARM64 issue
v4.1.1
- support Bitcode
- support Xcode 7
v4.1.0
- Fixed bug on orientation changes
- Converted lib to ARC
v4.0.3
- Fixed bug in init function with Request UUID in release mode
v4.0.2
- Weak link of AdSupport framework
- Added init function with option to pass a custom param and receive it on server-to-server callback
- Added UserAttributesDictionary class for passing attributes around user
- Added various bug fixes and optimizations
v4.0.1
- Added support of circle questions
- Added various bug fixes and optimizations
v4.0.0
- Added various bug fixes and optimizations
Note: This version of the SDK is deprecated. Please use the latest SDK
- Download Pollfish iOS SDK and unzip it
- Import pollfish.xcframework to your project
- Import AdSupport.framework, SystemConfiguration.framework, WebKit.framework and CoreTelephony.framework to your project
- Call init function of Pollfish when a view is loaded or in the App’s Delegate
- Set to Release mode and release in AppStore
- Update your privacy policy
- Request your account to get verified from Pollfish Dashboard
or
- Add a Podfile with Pollfish framework as a pod reference:
platform :ios, '9.0'
pod 'Pollfish'
You can find latest Pollfish iOS SDK version on CocoaPods here
- Run pod install on the command line to install Pollfish cocoapod.
- Call init function of Pollfish in the App’s Delegate
- Set to Release mode and release in AppStore
- Update your Privacy Policy both in the app and on AppStore Connect
- Request your account to get verified from Pollfish Dashboard
> **Requirements:** Pollfish framework works with iOS version 9.0+ and XCode9+.
To continue using Pollfish surveys with iOS 14 you’ll need to update to the latest Pollfish iOS SDK (version 5.3.0 or later)!
Register as a Publisher at www.pollfish.com
Login at www.pollfish.com and click "Add a new app" on Pollfish Developer Dashboard. Copy then the given API key for this app in order to use later on, when initializing Pollfish within your code.
Download Pollfish iOS SDK from the website and then in Xcode, select the target that you want to use and in the Build Phases tab expand the Link Binary With Libraries section. Press the + button, and press Add other… In the dialog box that appears, go to the Pollfish framework’s location and select it.
The project will appear at the top of the Link Binary With Libraries section and will also be added to your project files (left-hand pane).
Note: The framework is a folder and you should add the whole folder into your project.
- AdSupport.framework
- CoreTelephony.framework
- SystemConfiguration.framework
- WebKit.framework (added in Pollfish v4.4.0)
Note: If your deployment target is less than iOS 7.0, change the AdSupport.framework from Required to Optional.
Add a Podfile with Pollfish framework as a pod reference:
platform :ios, '9.0'
pod 'Pollfish'
You can find latest Pollfish iOS SDK version on CocoaPods here
Run pod install on the command line to install Pollfish cocoapod.
You have to include Pollfish library headers in any file that you will use Pollfish.
#import <Pollfish/Pollfish.h>
import Pollfish
A good place to call Pollfish init function is in the application’s delegate applicationDidBecomeActive method. This way it is ensured that Pollfish surveys will be refreshed each time the application will become active. (another placement could be in the viewDidLoad or viewWillAppear methods of a ViewController).
| Note: Init function affects the view hierarchy of the app. Therefore it shoud be called from the main thread that created the view hierarchy.
In order to initialize, you need the API key of your app (step 2 above) and also an instance of PollfishParams. PollfishParams has several params that affect the behaviour of Pollfish survey panel.
Below you can see an example on how you can initialize Pollfish with the help of PollfishParams onject:
Objective-C:
- (void)applicationDidBecomeActive:(UIApplication *)application
{
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.indicatorPosition=PollFishPositionMiddleRight;
pollfishParams.indicatorPadding=10;
pollfishParams.releaseMode= false;
pollfishParams.offerwallMode= false;
pollfishParams.rewardMode=false;
pollfishParams.requestUUID=@"USER_ID";
}];
[Pollfish initWithAPIKey:@"YOUR_API_KEY" andParams:pollfishParams];
}
Swift:
func applicationDidBecomeActive(application: UIApplication) {
let pollfishParams = PollfishParams ()
pollfishParams.indicatorPosition=Int32(PollfishPosition.PollFishPositionMiddleRight.rawValue);
pollfishParams.indicatorPadding=10;
pollfishParams.releaseMode = false;
pollfishParams.offerwallMode = false;
pollfishParams.requestUUID="USER_ID";
Pollfish.initWithAPIKey("YOUR_API_KEY", andParams: pollfishParams);
}
You can set several params to control the behaviour of Pollfish survey panel within your app wih the use of PollfishParams instance. Below you can see all the available options.
| Note: All the params are optional, however you should at least use the releaseMode setting to turn your integration in release mode prior uploading to AppStore
No | Description |
---|---|
5.2.1 | .indicatorPosition(PollfishPosition (int)) Sets the Position where you wish to place the Pollfish indicator |
5.2.2 | .requestUUID(NSString *) Sets a unique id to identify a user and be passed through server-to-server callbacks |
5.2.3 | .indicatorPadding(int) Sets the padding from the top or the bottom of the view, according to the Position of Pollfish indicator |
5.2.4 | .pollfishViewContainer(UIView *) Sets a view container that Pollfish surveys will be rendered above it |
5.2.5 | .releaseMode(BOOL) Sets Pollfish SDK to Developer or Release mode |
5.2.6 | .rewardMode(BOOL) Initializes Pollfish in reward mode |
5.2.7 | .surveyFormat(NSString *) Explicitly requests a specific survey format |
5.2.8 | .offerwallModel(BOOL) Sets Pollfish to offerwall mode |
5.2.9 | .userAttributes(NSMutableDictionary *) Provides user attributes upfront during initialization |
#### **5.2.1 .indicatorPosition (PollfishPosition (int))** This setting sets the Position where you wish to place Pollfish indicator ![alt text](https://storage.googleapis.com/pollfish_production/multimedia/pollfish_indicator_small.png) Pollfish indicator is shown only if Pollfish is used in a non rewarded mode.
There are six different options available:
- PollFishPositionBottomLeft
- PollFishPositionBottomRight
- PollFishPositionTopLeft
- PollFishPositionTopRight
- PollFishPositionMiddleLeft
- PollFishPositionMiddleRight
If you do not set explicity a position for Pollfish indicator, it will appear by default at PollFishPositionMiddleRight
Below you can see an example on how you can set Pollfish indicator to slide from the top right middle of the screen:
Objective-C:
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.indicatorPosition=PollFishPositionMiddleRight;
}];
Swift:
let pollfishParams = PollfishParams ()
pollfishParams.indicatorPosition=Int32(PollfishPosition.PollFishPositionMiddleRight.rawValue);
indicatorPosition param affects also from which side the survey panel will slide-in (Right or Left).
Sets a unique id to identify a user and be passed through server-to-server callbacks. You can read more on how to retrieve this param through the callbacks here.
Below you can see an example on how you can pass a requestUUID during initialization:
Objective-C:
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.requestUUID=@"USER_ID";
}];
Swift:
let pollfishParams = PollfishParams ()
pollfishParams.requestUUID="USER_ID";
#### **5.2.3 .indicatorPadding (int)**
Sets padding from the top or the bottom of the screen according to the Position of the Pollfish indicator. Below you can see an example on how to add padding of 50 from the bottom of the screen, prior rendering Pollfish indicator.
Objective-C:
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.indicatorPadding=50;
pollfishParams.indicatorPosition=PollFishPositionBottomRight;
}];
Swift:
let pollfishParams = PollfishParams ()
pollfishParams.indicatorPadding=50;
pollfishParams.indicatorPosition=Int32(PollfishPosition.PollFishPositionBottomRight.rawValue);
| **Note:** if used in MIDDLE position, padding is calculating from top.**
#### **5.2.4 .pollfishViewContainer (UIView \*)**
Sets a UIView container where Pollfish surveys will be rendered above it. If this param is not set, the SDK will traverse the view hierarchy of the app and render Pollfish surveys on the top view of the root view controller.
Preferrably you should let the SDK handle the view hierarchy on its own.
Objective-C:
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.pollfishViewContainer=self.view;
}];
Swift:
let pollfishParams = PollfishParams ()
pollfishParams.pollfishViewContainer=self.view;
#### **5.2.5 .releaseMode (BOOL)**
Sets Pollfish SDK to Developer or Release mode. If you do not set this param it will turn the SDK to Developer mode by default in order for the developer to be able to test with test surveys.
You can use Pollfish either in Debug or in Release mode.
- Debug/Developer mode is used to show to the developer how Pollfish will be shown through an app (useful during development and testing - always returns a survey).
- Release mode is the mode to be used for a released app in AppStore (start receiving paid surveys).
| Note: Be careful to set releaseMode parameter to true prior releasing to AppStore!
Objective-C:
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.releaseMode=true;
}];
Swift:
let pollfishParams = PollfishParams ()
pollfishParams.releaseMode=true;
#### **5.2.6 .rewardMode (BOOL)**
Initializes Pollfish in reward mode. This means that Pollfish Indicator will not be shown and Pollfish survey panel will be automatically hidden until the publisher explicitly calls Pollfish show function. This behaviour enables the option for the publisher, to show a custom prompt to incentivize the user to participate to the survey.
If not set, the default value is false and Pollfish indicator is shown.
Objective-C:
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.rewardMode=true;
}];
Swift:
let pollfishParams = PollfishParams ()
pollfishParams.rewardMode=true;
You can read more on how you can use the rewardMode to incentivize users to participate to surveys in the following link.
#### **5.2.7 .surveyFormat (NSString \*)**
Explicitly requests a specific survey format for testing purposes.
| Note: This param is ignored when offerwall mode is true
If you want to test Pollfish different available Survey Formats you can request a specific survey format during initialization
There are four different options available:
- SurveyFormatBasic
- SurveyFormatPlayful
- SurveyFormatRandom
- SurveyFormatThirdParty
Below you can see an example on how you can explicitly request to test Pollfish Plaful Survey Format in debug mode:
Objective-C:
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.surveyFormat=SurveyFormatBasic;
pollfishParams.releaseMode=false;
}];
Swift:
let pollfishParams = PollfishParams ()
pollfishParams.surveyFormat=SurveyFormatBasic;
pollfishParams.releaseMode=false;
Enables Pollfish in offerwall mode. If not specified Pollfish is shown as one survey at a time.
Below you can see an example on how you can intialize Pollfish in offerwall mode in an incentivized integration:
Objective-C:
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.offerwallModel=true;
pollfishParams.rewardMode=true;
pollfishParams.releaseMode=false;
}];
Swift:
let pollfishParams = PollfishParams ()
pollfishParams.offerwallModel=true;
pollfishParams.rewardMode=true;
pollfishParams.releaseMode=false;
#### **5.2.9 .userAttributes(NSMutableDictionary \*)**
Passing user attributes to skip or shorten Pollfish Demographic surveys.
If you know upfront some user attributes like gender, age, education and others you can pass them during initialization in order to shorten or skip entirely Pollfish Demographic surveys and archieve better fill rate and higher priced surveys.
| Note: You need to contact Pollfish live support on our website to request your account to be eligible for submitting demographic info through your app, otherwise values submitted will be ignored by default.
an example of how you can create and pass a user attributes dictionary during initialization can be the following below:
Objective-C:
UserAttributesDictionary *userAttributesDictionary = [[UserAttributesDictionary alloc] init];
[userAttributesDictionary setGender: GENDER(MALE)];
[userAttributesDictionary setRace:RACE(WHITE)];
[userAttributesDictionary setYearOfBirth:YEAR_OF_BIRTH(_1984)];
[userAttributesDictionary setMaritalStatus:MARITAL_STATUS(MARRIED)];
[userAttributesDictionary setParentalStatus:PARENTAL_STATUS(THREE)];
[userAttributesDictionary setEducation:EDUCATION_LEVEL(UNIVERSITY)];
[userAttributesDictionary setEmployment:EMPLOYMENT_STATUS(EMPLOYED_FOR_WAGES)];
[userAttributesDictionary setCareer:CAREER(TELECOMMUNICATIONS)];
[userAttributesDictionary setIncome:INCOME(MIDDLE_I)];
PollfishParams *pollfishParams = [PollfishParams initWith:^(PollfishParams *pollfishParams) {
pollfishParams.userAttributes=userAttributesDictionary;
}];
Swift:
let userAttributesDictionary:UserAttributesDictionary = [:]
/*included in Demographic Surveys*/
userAttributesDictionary.setGender(GENDER(MALE));
userAttributesDictionary.setRace(RACE(WHITE));
userAttributesDictionary.setYearOfBirth(YEAR_OF_BIRTH(_1984));
userAttributesDictionary.setMaritalStatus(MARITAL_STATUS(MARRIED));
userAttributesDictionary.setParentalStatus(PARENTAL_STATUS(THREE));
userAttributesDictionary.setEducation(EDUCATION_LEVEL(UNIVERSITY));
userAttributesDictionary.setEmployment(EMPLOYMENT_STATUS(EMPLOYED_FOR_WAGES));
userAttributesDictionary.setCareer(CAREER(TELECOMMUNICATIONS));
userAttributesDictionary.setIncome(INCOME(MIDDLE_I));
let pollfishParams = PollfishParams ()
pollfishParams.userAttributes=userAttributesDictionary;
**At this point you are ready to go live! Turn your app to Release mode by setting releaseMode:true and submit your app to AppStore.**
### 6\. Distributing your app to AppStore
Pollfish uses Advertising Identifier (IDFA) for survey distribution and therefore when submitting your app to the App you should select the following options as seen in the image below:
Add the following paragraph to your App's Privacy Policy:
“Survey Serving Technology
This app uses Pollfish SDK. Pollfish is an on-line survey platform, through which, anyone may conduct surveys. Pollfish collaborates with Publishers of applications for smartphones in order to have access to users of such applications and address survey questionnaires to them. When a user connects to this app, a specific set of user's device data (including Advertising ID, Device ID, other available electronic identifiers and further response meta-data is automatically sent, via our app, to Pollfish servers, in order for Pollfish to discern whether the user is eligible for a survey. For a full list of data received by Pollfish through this app, please read carefully the Pollfish respondent terms located at https://www.pollfish.com/terms/respondent. These data will be associated with your answers to the questionnaires whenever Pollfish sends such questionnaires to eligible users. Pollfish may share such data with third parties, clients and business partners, for commercial purposes. By downloading the application, you accept this privacy policy document and you hereby give your consent for the processing by Pollfish of the aforementioned data. Furthermore, you are informed that you may disable Pollfish operation at any time by visiting the following link https://www.pollfish.com/respondent/opt-out. We once more invite you to check the Pollfish respondent's terms of use, if you wish to have more detailed view of the way Pollfish works and with whom Pollfish may further share your data."
and on App Store Connect in the App's Privacy Policy section, update the relevant data collection questionnaire with the following choices as suggested by the latest AppStore's policies:
Type | Description | App Tracking | Explanation |
---|---|---|---|
Contact Info | --- | --- | --- |
Name | Such as first or last name | NO | |
Email Address | Including but not limited to a hashed email address | NO | |
Phone Number | Including but not limited to a hashed phone number | NO | |
Physical Addrress | Such as home address, physical address, or mailing address | NO | |
Other User Contact Info | Any other information that can be used to contact the user outside the app | NO | |
Health & Fitness | --- | --- | --- |
Health | Health and medical data, including but not limited to from the Clinical Health Records API, HealthKit API, MovementDisorderAPIs, or health-related human subject research or any other user provided health or medical data | Data use: Third-Party Advertising Linked to user: Yes Tracking: No | Pollfish does not directly collect any health data. However some clients might create surveys that could be asking some general health questions |
Fitness | Fitness and exercise data, including but not limited to the Motion and Fitness API | Data use: Third-Party Advertising Linked to user: Yes Tracking: No | Pollfish does not directly collect any fitness data. However some clients might create surveys that could be asking some general fitness questions |
Financial Info | --- | --- | --- |
Payment Info | Such as form of payment, payment card number, or bank account number | NO | |
Credit Info | Such as credit score | NO | |
Other Financial Info | Such as salary, income, assets, debts, or any other financial information | Data use: Third-Party Advertising Linked to user: Yes Tracking: Yes | Income data are collected as part of the demographic data during the onboarding process |
Location | --- | --- | --- |
Precise Location | Information that describes the location of a user or device with the same or greater resolution as a latitude and longitude with three or more decimal places | NO | |
Coarse Location | Information that describes the location of a user or device with lower resolution than a latitude and longitude with three or more decimal places, such as approximate location services | NO | |
Sensitive Info | --- | --- | --- |
Sensitive Info | Such as racial or ethnic data, sexual orientation, pregnancy or childbirth information, disability, religious or philosophical beliefs, trade union membership, political opinion, genetic information, or biometric data | Data use: Third-Party Advertising Linked to user: Yes Tracking: Yes | Demographic data such as the number of children or race are asked during the demographic data collection process when onboarding a user |
Contacts | --- | --- | --- |
Contacts | Such as a list of contacts in the user’s phone, address book, or social graph | NO | |
User Content | --- | --- | --- |
Emails or Text Messages | Including subject line, sender, recipients, and contents of the email or message | NO | |
Photos or Videos | The user’s photos or videos | NO | |
Audio Data | The user’s voice or sound recordings | NO | |
Gameplay Content | Such as user-generated content in-game | NO | |
Customer Support | Data generated by the user during a customer support request | NO | |
Other User Content | Any other user-generated content | Data use: Third-Party Advertising Linked to user: Yes Tracking: Yes | Different types of open ended questions might be asked within surveys |
Browsing History | --- | --- | --- |
Browsing History | Information about the content the user has viewed | NO | |
Search History | --- | --- | --- |
Search History | Information about searches the user has performed | NO | |
Identifiers | --- | --- | --- |
User ID | Such as screen name, handle, account ID, assigned user ID, customer number, or other user- or account-level ID that can be used to identify a particular user or account | Data use: Third-Party Advertising Linked to user: Yes Tracking: Yes | Publishers can pass a unique user ID and receive it back in s2s callbacks |
Device ID | Such as the device’s advertising identifier, or other device-level ID | Data use: Third-Party Advertising Linked to user: Yes Tracking: Yes | Pollfish SDK works upon the IDFA |
Purchases | --- | --- | --- |
Purchase History | An account’s or individual’s purchases or purchase tendencies | NO | |
Usage Data | --- | --- | --- |
Product Interaction | Such as app launches, taps, clicks, scrolling information, music listening data, video views, saved place in a game, video, or song, or other information about how the user interacts with the app | NO | |
Advertising Data | Such as information about the advertisements the user has seen | NO | Pollfish monitors the number of surveys a user has seen but not any advertisement within or outside it's context |
Other Usage Data | Any other data about user activity in the app | NO | |
Diagnostics | --- | --- | --- |
Crash Data | Such as crash logs | NO | |
Performance Data | Such as launch time, hang rate, or energy use | NO | |
Other Diagnostic Data | Any other data collected for the purposes of measuring technical diagnostics related to the app | NO | |
Other Data | --- | --- | --- |
Other Data Types | Any other data types not mentioned | Data use: Third-Party Advertising Linked to user: Yes Tracking: Yes | Different types of data can be collected through surveys |
---
You can have a look for some integration tips here or if have any question, like why you do not see surveys on your own device in release mode, please have a look in our FAQ page
| Note: Please bear in mind that the first time a user is introduced to the platform, when no paid surveys are available, a standalone demographic survey will be shown, as a way to increase the user's exposure in our clients' survey inventory. This survey returns no payment to app publishers, since it is part of the process that users need to go through, in order to join the platform. If a paid survey is available at that point of time, the demographic questions will be inserted at the begining of the survey, before the actual survey questions. Our aim is to provide advanced targeting solutions to our customers and to do that we need to have this information on the available users. Targeting by marital status or education etc. are highly popular options in the survey world and we need to keep up with the market. A vast majority of our clients are looking for this option when using the platform. Based on previous data, over 80% of the surveys designed on the platform require this type of targeting.
In our efforts to include publishers in this process and be as transparent as possible we provide full control over the process. We let publishers decide if their users are served these standalone surveys or not, in 2 different ways. Firstly by monitoring the process in code and excluding any users by listening to the relevant noitifications (Pollfish Survey Received, Pollfish Survey Completed) and checking the Pay Per Survey (PPS) field which will be 0 USD cents. Secondly, publishers can disable the standalone demographic surveys through the Pollfish Developer Dashboard in the Settings area of an app. You can read more on demographic surveys here.
If you know attributes about a user like gender, age and others, you can provide them during initialization as described in section 9 - "Passing user attributes to skip or shorten Pollfish Demographic surveys" and skip or shorten this way, Pollfish Demographic surveys.
After your app is published on an app store you should request your account to get verified from your Pollfish Developer Dashboard.
When your account is verified you will be able to start receiving paid surveys from Pollfish clients.
In this section we will list several options that can be used to control Pollfish surveys behaviour like listening and acting on different notifications. All the steps below are optional.
Pollfish SDK does not handle by default different orientation changes. If your app supports more than one orientations you should register and get notified when a device is roated and re-init Pollfish.
For example:
Objective-C:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appRotated) name:UIDeviceOrientationDidChangeNotification object:nil];
-(void) appRotated{
// Pollfish re-init
}
Swift:
NotificationCenter.default.addObserver(forName: UIDevice.orientationDidChangeNotification,
object: nil,
queue: nil,
using:appRotated)
func appRotated(_ notification:Notification){
// Pollfish re-init
}
### 10\. Manually show or hide Pollfish (optional)
You can manually hide and show Pollfish from your various UIVIewControllers. by calling anywhere after initialization:
Objective-C:
[Pollfish show];
Swift:
Pollfish.show()
or
Objective-C:
[Pollfish hide];
Swift:
Pollfish.hide()
For example:
Objective-C:
// MyViewController1
- (void)viewWillAppear:(BOOL)animated
{
// ...
[Pollfish hide];
}
// MyViewController2
- (void)viewWillAppear:(BOOL)animated
{
// ...
[Pollfish show];
}
Swift:
// MyViewController1
override func viewWillAppear(animated: Bool)
{
super.viewWillAppear(animated)
// ...
Pollfish.hide()
}
// MyViewController2
override func viewWillAppear(animated: Bool)
{
super.viewWillAppear(animated)
// ...
Pollfish.hide()
}
Note: Pollfish listeners/notifications fire in an asynchronous way. Having said that it's possible that you receive them while being in a background thread and not the main UI thread. If you want to make any prompts or custom changes on the view level when you receive those notifications, please be sure to make them on the main UI thread
You can be notified when a survey is received via the iOS Notification Center. Note that the observer should be already registered when a survey is received in order to run the selector.
Objective-C:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pollfishReceived:) name:@"PollfishSurveyReceived" object:nil];
- (void)pollfishReceived:(NSNotification *)notification
{
int surveyPrice = [[[notification userInfo] valueForKey:@"survey_cpa"] intValue];
int surveyIR = [[[notification userInfo] valueForKey:@"survey_ir"] intValue];
int surveyLOI = [[[notification userInfo] valueForKey:@"survey_loi"] intValue];
NSString *surveyClass =[[notification userInfo] valueForKey:@"survey_class"];
NSString *rewardName = [[notification userInfo] valueForKey:@"reward_name"];
int rewardValue = [[[notification userInfo] valueForKey:@"reward_value"] intValue];
NSLog(@"Pollfish: Survey Received - SurveyPrice:%d andSurveyIR: %d andSurveyLOI:%d andSurveyClass:%@ andRewardName:%@ andRewardValue:%d", surveyPrice,surveyIR, surveyLOI, surveyClass, rewardName, rewardValue);
}
Swift:
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: "PollfishSurveyReceived"),
object: nil,
queue: nil,
using:pollfishReceived)
func pollfishReceived(_ notification:Notification) {
if let userInfo : [AnyHashable: Any] = (notification.userInfo) {
let surveyPrice = userInfo["survey_cpa"]
let surveyIR = userInfo["survey_ir"]
let surveyLOI = userInfo["survey_loi"]
let surveyClass = userInfo["survey_class"]
let rewardName = userInfo["reward_name"]
let rewardValue = userInfo["reward_value"]
print("Pollfish Survey Received - SurveyPrice: \(String(describing: surveyPrice)) andSurveyIR: \(String(describing: surveyIR)) andSurveyLOI: \(String(describing: surveyLOI)) andSurveyClass: \(String(describing: surveyClass)) andRewardName: \(String(describing: rewardName)) andRewardValue:\(String(describing: rewardValue))")
}else{
print("Pollfish Survey Received")
}
}
As you may see in the example above you can get informed for the following values by listening and reading the relevant notification object:
| Note: This notification object, when offerwall mode is enabled, it returns an empty userInfo object. It just notifies that surveys are available within the offerwall.
- survey_cpa : money to be earned from survey received in US dollar cents (estimated based on daily exchange currency)
- survey_ir : the current estimation for the survey incidence rate as an integer number in the range 0-100. This param is optional and will have as default the value -1 if it was not set and the IR was not computed reliably.
- survey_loi : the expected time in minutes that it takes to complete the survey. This param is optional and will have as default the value -1 if it was not set and the LOI wan not computed reliably.
- survey_class : information about the survey network and type*
- reward_name : a virtual reward name as specified on Developer Dashboard*
- reward_vale : a virtual reward value as caluclated via a given echange rate on Developer Dashboard.*
- The syntax for survey_class values is:
survey_class: provider["/"type]
provider: "Pollfish" | "Toluna" | "Cint" | "Lucid" | "InnovateMR" | "SaySo" | "P2Sample"
type: "Basic" | "Playful" | "ThirdParty" | "Demographics" | "Internal"
that is a network name followed by an optional slash and survey type.
The provider is the network that provides the survey. The syntax rule has all the networks currently supported by Pollfish.
The type is that of the survey as described in the network's documentation. The exception is the type "Demographics" which is always used to identify surveys whose purpose is to collect demographic data for the users.
The whole set of values currently supported are:
Value | Description |
---|---|
Pollfish | Pollfish Basic survey |
Pollfish/Basic | Pollfish Basic survey (another name) |
Pollfish/Playful | Pollfish Playful survey |
Pollfish/ThirdParty | Pollfish 3rd party survey |
Pollfish/Demographics | Pollfish Demographic survey |
Pollfish/Internal | Pollfish internal survey created by the publisher |
Toluna | Toluna survey |
Cint | Cint survey |
InnovateMR | InnovateMR survey |
SaySo | SaySo survey |
P2Sample | P2Sample survey |
When a new mediation network enters the Pollfish network the appropriate values will be added.
### 11.2 Get notified when a survey is completed
Objective-C:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pollfishCompleted:) name:@"PollfishSurveyCompleted" object:nil];
- (void)pollfishCompleted:(NSNotification *)notification
{
int surveyPrice = [[[notification userInfo] valueForKey:@"survey_cpa"] intValue];
int surveyIR = [[[notification userInfo] valueForKey:@"survey_ir"] intValue];
int surveyLOI = [[[notification userInfo] valueForKey:@"survey_loi"] intValue];
NSString *surveyClass =[[notification userInfo] valueForKey:@"survey_class"];
NSString *rewardName = [[notification userInfo] valueForKey:@"reward_name"];
int rewardValue = [[[notification userInfo] valueForKey:@"reward_value"] intValue];
NSLog(@"Pollfish: Survey Completed - SurveyPrice:%d andSurveyIR: %d andSurveyLOI:%d andSurveyClass:%@ andRewardName:%@ andRewardValue:%d", surveyPrice,surveyIR, surveyLOI, surveyClass, rewardName, rewardValue);
}
Swift:
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: "PollfishSurveyCompleted"),
object: nil,
queue: nil,
using:pollfishCompleted)
func pollfishCompleted(_ notification:Notification) {
if let userInfo : [AnyHashable: Any] = (notification.userInfo) {
let surveyPrice = userInfo["survey_cpa"]
let surveyIR = userInfo["survey_ir"]
let surveyLOI = userInfo["survey_loi"]
let surveyClass = userInfo["survey_class"]
let rewardName = userInfo["reward_name"]
let rewardValue = userInfo["reward_value"]
print("Pollfish Survey Completed - SurveyPrice: \(String(describing: surveyPrice)) andSurveyIR: \(String(describing: surveyIR)) andSurveyLOI: \(String(describing: surveyLOI)) andSurveyClass: \(String(describing: surveyClass)) andRewardName: \(String(describing: rewardName)) andRewardValue:\(String(describing: rewardValue))")
}else{
print("Pollfish Survey Completed")
}
}
Similarly to survey received notification, upon completion you can get informed on the following values around the completed survey
- survey_cpa : money to be earned from survey received in US dollar cents (estimated based on daily exchange currency)
- survey_ir : the current estimation for the survey incidence rate as an integer number in the range 0-100. This param is optional and will have as default the value -1 if it was not set and the IR was not computed reliably.
- survey_loi : the expected time in minutes that it takes to complete the survey. This param is optional and will have as default the value -1 if it was not set and the LOI wan not computed reliably.
- survey_class : information about the survey network and type*
- reward_name : a virtual reward name as specified on Developer Dashboard*
- reward_vale : a virtual reward value as caluclated via a given echange rate on Developer Dashboard.*
### 11.3 Get notified when a user is not eligible for a Pollfish survey
You can be notified when a user is not eligible for a Pollfish survey after accepting to take one, via the iOS Notification Center.
Objective-C:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pollfishUsernotEligible) name:@"PollfishUserNotEligible" object:nil];
- (void)pollfishUsernotEligible
{
NSLog(@"Pollfish User Not Eligible");
}
Swift:
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: "PollfishUserNotEligible"),
object: nil,
queue: nil,
using:pollfishUsernotEligible)
func pollfishUsernotEligible(_ notification:Notification)
{
print("Pollfish User Not Eligible")
}
### 11.4 Get notified when no survey is available
You can be notified when a survey is not available for a user via the iOS Notification Center.
Objective-C:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pollfishNotAvailable) name:@"PollfishSurveyNotAvailable" object:nil];
- (void) surveyNotAvailable
{
NSLog(@"Pollfish Survey Not Available!");
}
Swift:
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: "PollfishSurveyNotAvailable"),
object: nil,
queue: nil,
using:pollfishNotAvailable)
func pollfishNotAvailable(_ notification:Notification)
{
print("Pollfish Survey Not Available!")
}
### 11.5 Get notified when Pollfish panel has opened
You can be notified when a user opens Pollfish survey panel via the iOS Notification Center.
Objective-C:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pollfishOpened) name:@"PollfishOpened" object:nil];
- (void)pollfishOpened
{
NSLog(@"Pollfish is opened!");
}
Swift:
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: "PollfishOpened"),
object: nil,
queue: nil,
using:pollfishOpened)
func pollfishOpened(_ notification:Notification)
{
print("Pollfish is opened!")
}
### 11.6 Get notified when Pollfish panel has closed
You can be notified when a user closes Pollfish survey panel via the iOS Notification Center.
Objective-C:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pollfishClosed) name:@"PollfishClosed" object:nil];
- (void)pollfishClosed
{
NSLog(@"Pollfish is closed!");
}
Swift:
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: "PollfishClosed"),
object: nil,
queue: nil,
using:pollfishClosed)
func pollfishClosed(_ notification:Notification)
{
print("Pollfish is closed!")
}
You can be notified when a user rejected a survey via the iOS Notification Center.
Objective-C:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pollfishUserRejectedSurvey) name:@"PollfishUserRejectedSurvey" object:nil];
- (void)pollfishUserRejectedSurvey
{
NSLog(@"Pollfish User Rejected Survey");
}
Swift:
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: "PollfishUserRejectedSurvey"),
object: nil,
queue: nil,
using:pollfishUserRejectedSurvey)
func pollfishUserRejectedSurvey(_ notification:Notification)
{
print("Pollfish User Rejected Survey")
}
It happens that time had past since you initialized Pollfish and a survey is received. If you want to check if survey is still avaialble on your device and has not expired you can check by calling:
Objective-C:
[Pollfish isPollfishPresent]
Swift:
Pollfish.isPollfishPresent()