ドキュメント

サポート

LevelPlay SDK - Android

Advanced settings for Android

Configure advanced settings in the LevelPlay Android SDK to define user IDs, set metadata, manage ad unit segments, and ensure compliance with privacy regulations.
読み終わるまでの所要時間 5 分最終更新 3日前

Define Segments

You can now easily tailor the way 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. LevelPlay SDK supports three methods to convey data to our servers to outline the user segment, namely:
  • Device Properties: the LevelPlay SDK collects certain standard parameters that pertain to the users' device automatically, such as location, device model, device manufacturer, app version, and OS. You do not need to convey this data to us.
  • User Properties: comprehensive user data (for example, age, gender, and 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 your user’s details so our SDK can categorize your different users based on the segments you defined on the LevelPlay platform.
  • Custom Segments: you can create a custom segment without conveying user details to our servers and tailor ad settings for that user segment.
Dynamic Segmentation If you're using LevelPlay SDK 7.2.0+, you can use the LevelPlaySegment 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

Once you’ve defined segments on the LevelPlay platform, you’ll need to inform our servers of the user’s particulars. 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:
mLPSegment.setSegmentName(name);
  1. Send us the user details. LevelPlay SDK provides a range of standard user properties that you can set to attribute a user to a segment in the API. Scroll down for a table of the support user segment properties.
// Create segment objectmLPSegment = new LevelPlaySegment();// Set user's levelmLPSegment.setLevel(level);// Set user creation datemLPSegment.setUserCreationDate(date);// Set user's total in-app purchasesmLPSegment.setIAPTotal(iapt);// Set user's paying statusmLPSegment.setIsPaying(isPaying);
In addition, you can set up to 5 custom user properties per segment:
// Set custom parameters (up to 5)mLPSegment.setCustom(key, value);
Next, to serve your ad units based on segments to tailor the user’s ad experience, call the following function with either the segment name or user properties:
LevelPlay.setSegment(mLPSegment);

Supported User Segment Properties

Segment Properties

Type

Limitation

Description

segmentNameStringalphanumeric up to 32 lettersThe given name of the segment in your LevelPlay account
PayingBooleanTrue or FalseTrue 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
userCreationDateLongCannot be smaller than 0The date the user installed the app in milliseconds
Custom Parameterskey=string, value=stringLevelPlay SDK supports up to 5 custom parameters alphanumeric up to 32 lettersAny additional data you'd like to dispatch to our server
Register to the following callback to receive the segment name that your user belongs to. If the callback string (segment name) returns empty, there were no correlating segments found for the user in the LevelPlay segment module.
SegmentListener onSegmentReceived(String segment){}

Custom Parameters for Rewarded server to server callbacks

LevelPlay reward-based ad units support server-side events to notify you of rewards that must be granted to your users after successful ad completion events. Learn more here. In addition to the server params, you can share run-time custom parameters through the client. To implement this, pass custom parameters to LevelPlay_Rewarded_Server_Params using the setMetaData API. Custom parameters can be updated several times throughout a session, overriding previous values. To reset the custom parameters, set LevelPlay_Rewarded_Server_Params to an empty array.

Example implementation code

LevelPlay.setMetaData("LevelPlay_Rewarded_Server_Params", List.of("key1=value1", "key2=value2"));
You will then receive a corresponding callback. Example:
http://www.mydomain.com/rewardsCallback?appUserId=[USER_ID]&rewards=[REWARDS]&eventId=[EVENT_ID]&itemName=[ITEM_NAME]&custom_key1=value1&custom_key2=value2

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 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 configurationvar adConfig = new LevelPlayInterstitialAd.Config.Builder() .setBidFloor(1.23) // Set the price floor in USD .build();// Apply the configuration to an interstitial ad unitvar interstitialAd = new LevelPlayInterstitialAd("adUnitId", adConfig);
Full interstitial implementation is available here.

Rewarded ads example

// Define a price floor configurationval adConfig = LevelPlayRewardedAd.Config.Builder() .setBidFloor(1.23) // Set the price floor in USD .build()// Apply the configuration to a rewarded ad unitval rewardedAd = LevelPlayRewardedAd("adUnitId", adConfig)
Full rewarded ads implementation is available here.

Banner ads example

// Define a price floor configurationvar adConfig = new LevelPlayBannerAd.Config.Builder() .setBidFloor(1.23) // Set the price floor in USD .build();// Apply the configuration to a banner ad unitvar bannerAd = new LevelPlayBannerAdView(context, "adUnitId", adConfig);
Full banner ads implementation is available here.

LevelPlay SDK Error Codes

LevelPlay SDK provides an error feedback mechanism to explain 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