Advanced settings
Configure advanced settings such as segmentation and custom parameters to tailor ad delivery and reporting.
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 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 such as creation date (refer to the full list of supported segment properties with descriptions below) must be relayed through the API. 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.
참고
If you're using LevelPlay SDK 7.2.0+, you can use 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 should inform our servers of the user's particulars.
Import the following from the Unity LevelPlay mediation package:
import { LevelPlaySegment, LevelPlay,} from 'unity-levelplay-mediation'
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:
-
If you are familiar with the segment that the user belongs to, set the segment name:
const segment = { segmentName: 'YOUR_SEGMENT_NAME' };LevelPlay.setSegment(segment);
-
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. Refer to the table below for supported segment properties.
const segment: LevelPlaySegment = { level: levelParam, // Int isPaying: isPayingParam, userCreationDate: dateTimeParam, // Long, milliseconds iapTotal: iapTotalParam, // Double customParameters: { customKey1: 'customValue1', customKey2: 'customValue2', customKey3: 'customValue3', customKey4: 'customValue4', customKey5: 'customValue5', },};LevelPlay.setSegment(segment);
Supported Segment Properties
Segment Properties | Type | Limitation | Description |
|---|
| segmentName | String | - alphanumeric - up to 32 letters | The given name of the segment in your LevelPlay account |
| Paying | Boolean | Yes 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_total | Double | 1-999999.99 | The total amount of money that the user has spent on in-app purchases |
| userCreationDate | Long | Cannot be smaller than 0 | The date the user installed the app, in milliseconds |
| Custom Parameters | key=string, value=string | - LevelPlay supports up to 5 custom parameters - alphanumeric - up to 32 letters | Any additional data you'd like to dispatch to our server |
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. You can 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.
Implementation Code
LevelPlay.setMetaData('LevelPlay_Rewarded_Server_Params', ['key1=value1', 'key2=value2'])
You will then receive a corresponding callback with your custom keys and values in the query string.
Example:
http://www.mydomain.com/rewardsCallback?appUserId=[USER_ID]&rewards=[REWARDS]&eventId=[EVENT_ID]&itemName=[ITEM_NAME]&custom_key1=value1&custom_key2=value2
참고
Min LevelPlay SDK 8.11.0. Maximum of 2,048 characters allowed.
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.
Properties | Type | Description |
|---|
| Bid floor | double | The price in USD that defines the minimum eCPM applied to traditional instances and bidders. |
Interstitial ads example
import { LevelPlayInterstitialAd } from 'unity-levelplay-mediation'// Create an interstitial ad and set the price floor in USDconst interstitialAd = new LevelPlayInterstitialAd('adUnitId')interstitialAd.setBidFloor(1.23)
Full interstitial implementation here
Rewarded ads example
import { LevelPlayRewardedAd } from 'unity-levelplay-mediation'// Create a rewarded ad and set the price floor in USDconst rewardedAd = new LevelPlayRewardedAd('adUnitId')rewardedAd.setBidFloor(1.23)
Full rewarded ads implementation is available here.
Banner ads example
Pass as a prop to set the price floor in USD:
import { LevelPlayBannerAdView, LevelPlayAdSize } from 'unity-levelplay-mediation'// Render a banner with a price floor of 1.23 USD<LevelPlayBannerAdView adUnitId="adUnitId" adSize={LevelPlayAdSize.BANNER} placementName={null} bidFloor={1.23}/>
Full banner 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 |
|---|
| 508 | N/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
|
| 509 | Interstitial, Rewarded Video | Show Fail: No ads to show |
| 510 | Interstitial, Rewarded Video, Banner | Load Fail: Server response failed |
| 520 | Interstitial, Rewarded Video | Show Fail: No internet connection; ShouldTrackNetworkState is enabled
Show Fail: No internet connection |
| 524 | Interstitial, Rewarded Video | Show Fail: Placement %@ has reached its limit as defined per pace
Show Fail: Placement %@ has reached its capping limit |
| 526 | Interstitial, Rewarded Video | Show Fail: Ad unit has reached its daily cap per session |
| 604 | Banner | Can’t load because the placement is capped |
| 605 | Banner | Unexpected exception while loading the banner |
| 606 | Banner | No banner fill on all the networks on the first load |
| 1007 | Interstitial, Rewarded Video | Auction Fail: Auction request did not contain all required information |
| 1022 | Rewarded Video | Show Fail: Cannot show an RV while another RV is showing |
| 1023 | Rewarded Video | Show Fail: Show RV called when there are no available ads to show |
| 1035 | Interstitial | Empty Waterfall |
| 1036 | Interstitial | Show Fail: Cannot show an interstitial while another interstitial is showing |
| 1037 | Interstitial | Load Fail: Cannot load an interstitial while another interstitial is showing |
| 1039 | Interstitial | Exception while calling show interstitial |