Skip to content

Latest commit

 

History

History
521 lines (325 loc) · 16 KB

ios-ironsource-adapter.md

File metadata and controls

521 lines (325 loc) · 16 KB
v6.4.2.0
  • Updating with Pollfish iOS SDK v6.4.2

v6.4.1.0

  • Updating with Pollfish iOS SDK v6.4.1

v6.4.0.0

  • Updating with Pollfish iOS SDK v6.4.0

v6.3.1.0

  • Updating with Pollfish iOS SDK v6.3.1

v6.3.0.0

  • Updating with Pollfish iOS SDK v6.3.0

v6.2.7.0

  • Updating with Pollfish iOS SDK v6.2.7

v6.2.5.0

  • Initial release

This guide is for publishers looking to use ironSource LevelPlay to load and show Rewarded Surveys from Pollfish in the same waterfall with other Rewarded Ads.


Prerequisites

Note: Pollfish surveys can work with or without the IDFA permission on iOS 14+. If no permission is granted in the ATT popup, the SDK will serve non personalized surveys to the user. In that scenario the conversion is expected to be lower. Offerwall integrations perform better compared to single survey integrations when no IDFA permission is given


Quick Guide

  • Set up IronSource Rewarded Ads
  • Set up Pollfish
  • Add Pollfish IronSource Adapter to your project
  • Publish your app

Analytical Steps

Below you can find a step by step guide on how to incorporate Pollfish surveys with ironSource LevelPlay:

1. Set up IronSource Rewarded Ads

1.1. Add Pollfish Network

First you need to sign in to your IronSource account. Add Pollfish Network as a Custom Network. On the side menu navigate to Monetize -> Setup -> SDK Netwokrs

Select you application from the Applications list and on the top of the page you will find a Manage Networks button. Click it and then click on the Custom Adapter option.

Type 15baf95f5 as the Custom Adapter Network key on the input prompt and click Enter Key.



You will be prompted to enter your Pollfish Reporting Key. You can retrieve your account key by loging in to Pollfish Publisher account and navigating to your Account information.




Select Reporting API for revenue reporting and click Save. You will find your newly added Network under the name Pollfish on each app's mediation network list.



Configure Pollfish Network by clicking on the Setup button on the Pollfish network row from your App's Network list.

Fill the following input fields.

Key Type
1.1.1. api_key
Sets Pollfish SDK API key as provided by Pollfish
String
1.1.2. request_uuid
Sets a pass-through param to be received via the server-to-server callbacks
String
1.1.3. release_mode
Sets Pollfish SDK to Developer or Release mode
Boolean
1.1.4. oferrwall_mode
Sets Pollfish SDK to Oferwall Mode
Boolean

1.1.1 api_key

Pollfish API Key as provided by Pollfish on Pollfish Dashboard after you sign up to the platform.

1.1.2 request_uuid or null

Sets a pass-through param to be received via the server-to-server callbacks.

In order to register for such callbacks you can set up your server URL on your app's page on Pollfish Developer Dashboard and then pass your requestUUID through ParamsBuilder object during initialization. On each survey completion you will receive a callback to your server including the requestUUID param passed.

If you would like to read more on Pollfish s2s callbacks you can read the documentation here

1.1.3. release_mode

Sets Pollfish SDK to Developer or Release mode.

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

1.1.4 oferrwall_mode

Enables offerwall mode. If not set, one single survey is shown each time.



After adding the above required info click Save


2. Set Up Pollfish

2.1. Obtain a Developer Account

Register as a Publisher at www.pollfish.com


2.2. Add new app on Pollfish Publisher Dashboard and copy the given API Key

Login at www.pollfish.com and click "Add a new app" on Pollfish Publisher Dashboard. Copy then the given API key for this app in order to use later on, when initializing Pollfish within your code.


3. Add Pollfish IronSource Adapter to your project

Manually import PollfishIronSourceAdapter

Download the following frameworks

and add them in your App's target dependecies

  1. Navigate to your project
  2. Select your App's target and go to the General tab section Frameworks, Libraries and Embedded Content
  3. Add all three dependent framewokrs one by one by pressing the + button -> Add other and selecting the appropriate framework

Add the following frameworks (if you don’t already have them) in your project

  • AdSupport.framework
  • CoreTelephony.framework
  • SystemConfiguration.framework
  • WebKit.framework (added in Pollfish v4.4.0)

OR

Retrieve Pollfish IronSource Adapter through CocoaPods

Add a Podfile with PollfishIronSourceAdapter pod reference:

pod 'PollfishIronSourceAdapter'

You can find the latest PollfishIronSourceAdapter version on CocoaPods here

Run pod install on the command line to install PollfishIronSourceAdapter pod.


Important step Objective-C based projects

For Objective-C based projects you will need to create an empty Swift file including Foundation framework and a bridging header file named YourProjectName-Bridging-Header.h. Skipping this step will result to compilation failure.


4. Request for a RewardedAd


Note: If you have already implemented Rewarded Ads in your app you can skip this step


Import IronSourceSDK

Swift

If you are using swift, you need to make sure your application is pointing to IronSource.h file to include the bridge you need.

Select your Project from the project navigator and navigate to Build Settings -> Swift Compiler - General and add the following path to the Objective-C Bridging Header setting.

The path to the bridging header varies according to the way the integration was done

CocoaPods

${PODS_ROOT}/IronSourceSDK/IronSource/IronSource.xcframework/ios-arm64_armv7/IronSource.framework/Versions/A/Headers/IronSource.h

Manual

Frameworks/IronSource.framework/Headers/IronSource.h

Once you’ve completed the above step, you can use Swift seamlessly within the ironSource SDK, without importing any additional Header Files.

Objective C

#import <IronSource/IronSource.h>

Request IDFA Permission (Recommended but optional)

Pollfish surveys can work with or without the IDFA permission on iOS 14+. If no permission is granted in the ATT popup, the SDK will serve non personalized surveys to the user. In that scenario the conversion is expected to be lower. Offerwall integrations perform better compared to single survey integrations when no IDFA permission is given.

To display the App Tracking Transparency authorization request for accessing the IDFA, update your Info.plist to add the NSUserTrackingUsageDescription key with a custom message describing your usage. Below is an example description text:

<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads/surveys to you.</string>

To present the authorization request, call requestTrackingAuthorization. We recommend waiting for the completion callback prior to initializing.

Swift

#if canImport(AppTrackingTransparency)
import AppTrackingTransparency
#endif

...

override func viewDidAppear(_ animated: Bool) {
    if #available(iOS 14, *) {
        requestIDFAPermission()
    } else {
        createAndLoadRewardedAd()
    }
}

@available(iOS 14, *)
func requestIDFAPermission() {
    #if canImport(AppTrackingTransparency)
    ATTrackingManager.requestTrackingAuthorization { status in
        DispatchQueue.main.async {
            self.createAndLoadRewardedAd()
        }
    }
    #endif
}

Objective C

#if __has_include(<AppTrackingTransparency/AppTrackingTransparency.h>)
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#endif

...

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    if (@available(iOS 14, *)) {
        [self requestIDFAPermission];
    } else {
        [self createAndLoadRewardedAd];
    }
}

- (void)requestIDFAPermission {
#if __has_include(<AppTrackingTransparency/AppTrackingTransparency.h>)
    if (@available(iOS 14, *)) {
        [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
            dispatch_async(dispatch_get_main_queue(), ^{
                [self createAndLoadRewardedAd];
            });
        }];
    } else {
        // Fallback on earlier versions
    }
#endif
}

Initialize the IronSource SDK in your ViewController's viewDidLoad, viewWillAppear methods or after the IDFA permission response, passing your App Key as provided by the IronSource dashboard.

Swift

func createAndLoadRewardedAd() {
    ...

    ISIntegrationHelper.validateIntegration()   
    IronSource.setRewardedVideoDelegate(self)
    IronSource.initWithAppKey("APP_KEY")
}

Objective C

- (void)createAndLoadRewardedAd {
    ...
    
    [ISIntegrationHelper validateIntegration];
    [IronSource initWithAppKey:@"APP_KEY"];
    [IronSource setRewardedVideoDelegate:self];
}

Comform to ISRewardedVideoDelegate so that you are notified when your ad is ready and of other ad-related events.

Swift

class ViewController: UIViewController, ISRewardedVideoDelegate

Objective C

@interface ViewController ()<MARewardedAdDelegate>

When the Rewarded Ad is ready, present the ad by invoking IronSource.showRewardedVideo.

Swift

IronSource.showRewardedVideo(with: self)

Objective C

[IronSource showRewardedVideoWithViewController:self];

You can view a short example on how to intergate rewarded ads below

Swift

import ObjectiveC.runtime
import AppTrackingTransparency

class ViewController: UIViewController, ISRewardedVideoDelegate {

    ...

    @IBOutlet weak var showRewardedAdButton: UIButton!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        ATTrackingManager.requestTrackingAuthorization { status in
            self.createRewardedAd()
        }
    }

    private func createRewardedAd() {
        ISIntegrationHelper.validateIntegration()
        
        IronSource.setRewardedVideoDelegate(self)
        IronSource.initWithAppKey(appKey)
    }
    
    @IBAction func showRewardedAd(_ sender: Any) {
        IronSource.showRewardedVideo(with: self)
    }

    #pragma mark - ISRewardedVideoDelegate Protocol

    public func didReceiveReward(forPlacement placementInfo: ISPlacementInfo!) {}
    
    func rewardedVideoDidFailToShowWithError(_ error: Error!) {}
    
    func rewardedVideoDidOpen() {}
    
    func rewardedVideoDidClose() {}
    
    func rewardedVideoDidEnd() {}
    
    func rewardedVideoDidStart() {}
    
    func rewardedVideoHasChangedAvailability(_ available: Bool) {
        showRewardedAdButton.isEnabled = available
    }
    
    func didClickRewardedVideo(_ placementInfo: ISPlacementInfo!) {}

}

Objective C

#import <IronSource/IronSource.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>

@interface ViewController()<ISRewardedVideoDelegate>
@property (weak, nonatomic) IBOutlet UIButton *showRewardedAdBtn;
@end

@implementation ViewController

...

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
        [self createRewardedAd];
    }];
}

- (void)createRewardedAd
{
    [ISIntegrationHelper validateIntegration];
    [IronSource initWithAppKey:@"APP_KEY"];
    [IronSource setRewardedVideoDelegate:self];
}

- (IBAction)showRewardedAd:(id)sender {
    [IronSource showRewardedVideoWithViewController:self];
}

#pragma mark - ISRewardedVideoDelegate Protocol

- (void)rewardedVideoHasChangedAvailability:(BOOL)available {
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.showRewardedAdBtn setEnabled:available];
    });
}

- (void)didReceiveRewardForPlacement:(ISPlacementInfo *)placementInfo {}

- (void)rewardedVideoDidFailToShowWithError:(NSError *)error {}

- (void)rewardedVideoDidOpen {}

- (void)rewardedVideoDidClose {}

- (void)rewardedVideoDidStart {}

- (void)rewardedVideoDidEnd {}

- (void)didClickRewardedVideo:(ISPlacementInfo *)placementInfo {}

@end

5. Publish your app on the store

If you everything worked fine during the previous steps, you should turn Pollfish to release mode and publish your app.

Note: After you take your app live, you should request your account to get verified through Pollfish Dashboard in the App Settings area.

Note: There is an option to show Standalone Demographic Questions needed for Pollfish to target users with surveys even when no actually surveys are available. Those surveys do not deliver any revenue to the publisher (but they can increase fill rate) and therefore if you do not want to show such surveys in the Waterfall you should visit your App Settings are and disable that option. You can read more here


Optional section

6. Payouts on Screenouts

In Market Research monetization users can get screened out within the survey since the Researcher might be looking a different user based on the provided answers. Screenouts do not deliver any revenue for the publisher nor any reward for the users. If you would like to activate payouts on screenouts too please follow the steps as described here.


More info

You can read more info on how the Pollfish SDKs work or how to get started with IronSource at the following links:

Pollfish iOS SDK

IronSource iOS SDK