Advanced settings
Configure advanced SDK settings such as custom parameters, price floors, and user segmentation to optimize ad delivery and monetization.
阅读时间3 分钟最后更新于 6 天前
Set UserID
If you’re using server-to-server callbacks to reward your users with LevelPlay rewarded ad units, or using Ad Quality user journey, you must define a unique identifier for each user (“UserID”), using the setUserID method. Set the UserID before the init request, to make sure you avoid any data losses, related to the user. Use a unique identifier, with a format of 64 characters String.LevelPlay.setUserId(userID)
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. Unity LevelPlay SDK supports the following methods to outline the user segment with Unity:Method | Description | Notes |
|---|---|---|
| Device Properties | The Unity LevelPlay SDK collects certain standard parameters that pertain to the user's device automatically such as location, device model, device manufacturer, app version, OS, etc. | You don't need to share this data with Unity. |
| User Properties | Comprehensive user data such as creation date, etc. (see 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 |
Pass User Properties
Once you defined segments on the LevelPlay platform, you need to inform Unity's servers of the user's details. Define what properties to send to Unity servers on which to base the segments. You can send this information through one of the following methods:-
If you're familiar with the segment that the user belongs to, enter the segment name:
segment.setSegmentName(name);
-
Send Unity 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.
final segment = LevelPlaySegment();segment.level = levelParam;segment.isPaying = isPayingParam;segment.userCreationDate = dateTimeParam;segment.iapTotal = iaptParam;// up to 5 custom paramssegment.setCustom(key: 'CustomKey1', value: 'CustomVal1');// Set LevelPlay SegmentLevelPlay.setSegment(segment);
Supported User Segment Properties
Segment Properties | Type | Limitation | Description |
|---|---|---|---|
| String |
| The given name of the segment in your LevelPlay account |
| Paying | Boolean | True or False |
|
| 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 |
| 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. Refer to the Server-to-server callback settings for more information. You can also share runtime custom parameters through the client. To implement this, pass custom parameters toLevelPlay_Rewarded_Server_ParamssetMetadataLevelPlay_Rewarded_Server_ParamsExample implementation Code
You then receive a corresponding callback such as the following:LevelPlay.setMetaData({ 'LevelPlay_Rewarded_Server_Params': ['key1=value1', 'key2=value2'],});
http://www.mydomain.com/rewardsCallback?appUserId=[USER_ID]&rewards=[REWARDS]&eventId=[EVENT_ID]&itemName=[ITEM_NAME]&custom_key1=value1&custom_key2=value2
LevelPlay SDK Error Codes
Unity 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 |
|
| 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 |