Aller au contenu principal
Version: 5.x.x

Unity LevelPlay

This guide shows you how to integrate our BlueStack mediation adapter of Unity LevelPlay with your current iOS app and set up additional request parameters.

Release notes can be found here

Supported ad formats

  • Banner
  • Rewarded
  • Interstitial

Requirements

  • Xcode 14.0 or higher
  • iOS: 12.2 or higher

Unity LevelPlay Configuration

When in the Unity LevelPlay dashboard, under your app in the left panel navigate to Setup -> Networks, in the right panel at the bottom of the page you have the option to Add custom network. img.png You'll be directe to a new page.

Please enter 15c080481 in the Network Key input field and click Confirm Key. After confirmation it will show the network name Improve Digital. Then click Save.

img.png

Custom Network Key: 15c080481
Custom Network Name: Improve Digital

Congratulations!!! You have added our network successfully.

Next navigate to Setup -> Instances in the left panel, and click Improve Digital in the right panel.

img.png

This will navigate you to a new page where you will add new instances for different types of ads.

img.png

Click on the button **+ Add Instance at the bottom in the right panel, select the type of ad you want to add.

img.png

Enter Instance Name, placementId, Rate, and select target Mediation Groups. Also add your appId at the top in the right panel and click Save.

Note: The placementIds will be provided by the Azerion team. And Rate is used for IronSource reporting only, it will not be a reflection of the actual money. Rates can be aligned with the Azerion team as well.

img.png

Integrate BlueStackLevelPlayMediationAdapter in your application project

In the Podfile of your application project add BlueStackLevelPlayMediationAdapter dependency

pod 'BlueStackLevelPlayMediationAdapter', '5.1.1.0'

Import custom event classes in your source file:

    @import BlueStackLevelPlayMediationAdapter;
@import IronSource;

Ad Formats

Supported ISBannerAdDelegate Callback

// Indicates that a banner ad was loaded successfully 
- (void)adDidLoadWithView:(UIView *) view

// The banner ad failed to load. Use ironSource ErrorTypes (No Fill / Other)
- (void)adDidFailToLoadWithErrorType:(ISAdapterErrorType)errorType
errorCode:(NSInteger)errorCode
errorMessage:(nullable NSString*)errorMessage

// Indicates an ad was clicked
- (void)adDidClick

Initialization and load Banner Ad

self.adView = [[LPMBannerAdView alloc] initWithAdUnitId:@"YOUR_BANNER_AD_UNIT_ID"];
// 1. recommended - Adaptive ad size that adjusts to the screen width
self.bannerSize = [LPMAdSize createAdaptiveAdSize];

// 2. Adaptive ad size using fixed width ad size
// self.bannerSize = [LPMAdSize createAdaptiveAdSizeWithWidth:400];

// 3. Specific banner size - BANNER, LARGE, MEDIUM_RECTANGLE
// self.bannerSize = [LPMAdSize mediumRectangleSize];

[self.adView setAdSize:self.bannerSize];
[self.bannerAd loadAdWithViewController:YOUR_VIEW_CONTROLLER_INSTANCE];

Interstitial

Supported ISInterstitialAdDelegate Callback

// Indicates that the interstitial ad was loaded successfully
- (void)adDidLoad;

// The interstitial ad failed to load. Use ironSource ErrorTypes (No Fill / Other)
- (void)adDidFailToLoadWithErrorType:(ISAdapterErrorType)errorType
errorCode:(NSInteger)errorCode
errorMessage:(NSString*)errorMessage;

// The interstitial ad was displayed successfully to the user. This indicates an impression.
- (void)adDidOpen;

// User closed the interstitial ad
- (void)adDidClose;

// The ad could not be displayed
- (void)adDidFailToShowWithErrorCode:(NSInteger)errorCode
errorMessage:(NSString*)errorMessage;

// Indicates the ad was clicked
- (void)adDidClick;

Initialization, load, and show Interstitial Ad

self.interstitialAd = [[LPMInterstitialAd alloc] initWithAdUnitId:@"YOUR_INTERSTITIAL_AD_UNIT_ID"];
[self.interstitialAd loadAd];
if ([self.interstitialAd isAdReady]) {
// This will present the Interstitial.
// Unlike Rewarded Videos there are no placements.

[self.interstitialAd showAdWithViewController:YOUR_VIEW_CONTROLLER placementName:NULL];
}

Rewarded

Supported ISRewardedVideoAdDelegate Callback

// Indicates that rewarded video ad was loaded successfully 
- (void)adDidLoad;

// The rewarded video ad failed to load. Use ironSource ErrorTypes (No Fill / Other)
- (void)adDidFailToLoadWithErrorType:(ISAdapterErrorType)errorType
errorCode:(NSInteger)errorCode
errorMessage:(NSString*)errorMessage;

// The rewarded video ad was displayed successfully to the user. This indicates an impression.
- (void)adDidOpen;

// User closed the rewarded video ad
- (void)adDidClose;

// The ad could not be displayed
- (void)adDidFailToShowWithErrorCode:(NSInteger)errorCode
errorMessage:(NSString*)errorMessage;

// User clicked the rewarded video ad
- (void)adDidClick;

// User received a reward after watching the ad
- (void)adRewarded;

Initialization, load, and show Rewarded Ad

LPMInitRequestBuilder *requestBuilder = [[LPMInitRequestBuilder alloc] initWithAppKey:kAppKey];
[requestBuilder withLegacyAdFormats:@[IS_REWARDED_VIDEO]];
LPMInitRequest *initRequest = [requestBuilder build];
[LevelPlay initWithRequest:initRequest completion:^(LPMConfiguration *_Nullable config, NSError *_Nullable error){

if(error) {
// There was an error on initialization. Take necessary actions or retry
return;
}

// Initialization was successful. You can now load banner ad or perform other tasks
}];

if ([IronSource hasRewardedVideo]) {
// This will present the Rewarded Video.
[IronSource showRewardedVideoWithViewController:self];
}

Set Privacy Settings

Change the privacy settings accordingly. By default both are false. Please note that you have to set them before initializing the Iron Source/LevelPlay SDK.

[BlueStackPrivacySettings setIsAgeRestrictedUser:YES];
[BlueStackPrivacySettings setUserOptout:YES];

Passing data for user targeting

ISConfigurations *isConfigurations = [ISConfigurations getConfigurations];
isConfigurations.userAge = USERS_AGE;
isConfigurations.userGender = USERS_AGE;
isConfigurations.customSegmentParams = @{@"bs_latitude": USERS_LATITUDE, @"bs_longitude": USERS_LONGITUDE, @"bs_consent_flag": LOCATION_CONSENT_FLAG};
  • 0 = Not allow to send location.
  • 1 = When you managed location according to consent value.
  • 2 and 3 = Allow the SDK to managed location directly in accordance with the consent value use TCF v1 or TCF v2, see with the madvertise team it depends on your implementation.