Documentation

Support

LevelPlay SDK - iOS

Advanced settings for iOS

Define user segments and configure other advanced settings in the LevelPlay SDK.
Read time 5 minutesLast updated 7 hours ago

Define Segments

You can now customize how you serve your ads to fit a specific audience! You'll need to inform our servers of the users' details so the SDK will know to serve ads according to the segment the user belongs to. The LevelPlay platform supports three methods to convey data to our servers to outline the user segment, namely:
  • Custom Segments: you can create a custom segment with predefined conditions without conveying user details to our servers and tailor ad settings for that user segment on the LevelPlay platform
  • User Properties: user data which is not collected by our SDK (for example, level, paying status, or creation date) must be relayed through the API. (See a full list of supported segment properties with descriptions in the following section). Follow the instructions to send us these details so our SDK can apply the relevant ad settings to the segments you defined on the LevelPlay platform
  • Device Properties: the LevelPlay SDK collects certain standard parameters that pertain to the users' device automatically such as device model, device manufacturer, app version, and OS. You do not need to convey this data to us
You can use LPMSegment API to change your segmentation during the session. This will affect the next loaded ad, and can be called before loading each ad unit, to dynamically affect the waterfall. You can learn more about LevelPlay segmentation here.

Pass User Properties

After you've defined segments on the LevelPlay platform, you should inform our servers of the user's particulars. LevelPlay provides a range of standard user properties that you can set to attribute a user to a segment in the API. First, init the segment:
LPMSegment *segment = [[LPMSegment alloc]init];
Define what properties to send to our servers on which to base the segments. You can transmit this information through one of the following methods:
  1. If you are familiar with the segment that the user belongs to, enter the segment name:
    [segment setSegmentName:YOUR_SEGMENT_NAME];
  2. Send us the user details. See table below for descriptions.
    // Set user level[segment setLevel:USER_LEVEL];// Set user's paying status[segment setPaying:USER_PAYING];// Set user's total in-app purchase history[segment setIapTotal:YOUR_IAP_TOTAL];// Set user creation date[segment setUserCreationDate:YOUR_DATE];
    In addition, you can set up to 5 custom user properties per segment:
    [segment setCustomValue:YOUR_CUSTOM_VALUE forKey:YOUR_CUSTOM_KEY];
    Next, to serve your ad units based on segments, call the following function complete with either the segment name or user properties:
    [LevelPlay setSegment:YOUR_SEGMENT];

Supported Segment Properties

Segment Properties

Type

Limitation

Description

segmentNameString- alphanumeric - up to 32 lettersThe given name of the segment in your LevelPlay account
PayingBooleanYes or No- True if the user has spent any money on in-app purchases - False if the user has not spent any money on in-app purchases
iap_totalDouble1-999999.99The total amount of money that the user has spent on in-app purchases
userCreationDateNSDateCannot be smaller than 0The date the user installed the app
Custom Parameterskey=string, value=string- LevelPlay supports up to 5 custom parameters - alphanumeric - up to 32 lettersAny additional data you'd like to dispatch to our server

Obtain the User's Segment Name

  1. Adopt this interface in your class to conform to the Segment Name protocol and enable the receipt of the segment name
    LPMSegmentDelegate
  2. Register to the following delegate to receive the segment name that your user belongs to. The SDK will then notify your delegate of the event.
    [LevelPlay setSegmentDelegate:self];
    Implement the delegate callback. For example:
    - (void)didReceiveSegment:(NSString *)segment;

Custom Parameters for Rewarded server to server callbacks

From LevelPlay SDK 8.11.0 you can pass custom parameters for Rewarded ad units that are sent to your server in server-to-server (S2S) callbacks. Set the parameters using
setMetaData
with the key
LevelPlay_Rewarded_Server_Params
and a JSON string value.
  • Custom parameters work in conjunction with server-to-server completion callbacks only. You will receive the parameters as part of the callback.
  • You may insert more than one custom parameter.
Example:
NSDictionary *params = @{ @"key1": @"value1", @"key2": @"value2" };NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:0 error:nil];NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];[LevelPlay setMetaDataWithKey:@"LevelPlay_Rewarded_Server_Params" value:jsonString];

Price Floor Configuration

The Floor Configuration API lets you set a price floor for a specific ad unit. By setting a price floor for each user, you can improve targeting efficiency, reduce latency, and optimize ad performance. The price floor must be assigned when creating the ad object, and it applies to all subsequent loads for that object.
Note
Min SDK version for this feature is 8.9.0.

Property

Type

Description

Bid floordoubleThe price in USD that defines the minimum eCPM applied to traditional instances and bidders.

Interstitial ads example

// Define a price floor configurationLPMInterstitialAdConfig *adConfig = [[[LPMInterstitialAdConfigBuilder new] setBidFloor:1.23] build]; // Set the price floor in USD// Apply the configuration to an interstitial ad unitLPMInterstitialAd *interstitialAd = [[LPMInterstitialAd alloc] initWithAdUnitId:@"adUnitId" config:adConfig];
Full interstitial implementation is available here.

Rewarded ads example

// Define a price floor configurationLPMRewardedAdConfig *adConfig = [[[LPMRewardedAdConfigBuilder new] setBidFloor:1.23] build]; // Set the price floor in USD// Apply the configuration to a rewarded ad unitLPMRewardedAd *rewardedAd = [[LPMRewardedAd alloc] initWithAdUnitId:@"adUnitId" config:adConfig];
Full rewarded ads implementation is available here.
// Define a price floor configurationLPMBannerAdViewConfig *adConfig = [[[LPMBannerAdViewConfigBuilder new] setBidFloor:1.23] build]; // Set the price floor in USD// Apply the configuration to a banner ad unitLPMBannerAdView *bannerAd = [[LPMBannerAdView alloc] initWithAdUnitId:@"adUnitId" config:adConfig];
Full banner ads implementation is available here.

LevelPlay SDK Error Codes

LevelPlay provides an error feedback mechanism to provide an explanation for any failure in the SDK integration. You will receive these errors when something went wrong or an aspect of the integration wasn't completed correctly. The LevelPlay Error object contains an error code and message. These are all the possible errors and their message based on their functions:

Error Codes

Ad Unit

Description

508N/A
  • Init failure of the mediation/Network
  • Calling a Demand Only API in non Demand Only mode
  • Calling a non Demand Only API in Demand Only mode
509Interstitial, Rewarded VideoShow Fail: No ads to show
510Interstitial, Rewarded Video, BannerLoad Fail: Server response failed
520Interstitial, Rewarded VideoShow Fail: No internet connection; ShouldTrackNetworkState is enabled Show Fail: No internet connection
524Interstitial, Rewarded VideoShow Fail: Placement %@ has reached its limit as defined per pace Show Fail: Placement %@ has reached its capping limit
526Interstitial, Rewarded VideoShow Fail: Ad unit has reached its daily cap per session
604BannerCan’t load because the placement is capped
605BannerUnexpected exception while loading the banner
606BannerNo banner fill on all the networks on the first load
1007Interstitial, Rewarded VideoAuction Fail: Auction request did not contain all required information
1022Rewarded VideoShow Fail: Cannot show an RV while another RV is showing
1023Rewarded VideoShow Fail: Show RV called when there are no available ads to show
1035InterstitialEmpty Waterfall
1036InterstitialShow Fail: Cannot show an interstitial while another interstitial is showing
1037InterstitialLoad Fail: Cannot load an interstitial while another interstitial is showing
1039InterstitialException while calling show interstitial