Set user IDs, define user segments, and configure other advanced settings in the ironSource SDK.
Read time 5 minutesLast updated 2 months ago
Set UserID
If you’re using server-to-server callbacks to reward your users with ironSource 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 loses, related to the user. Use a unique identifier, with a format of 64 characters NSString.
[IronSource setUserId:YOUR_USERID];
IronSource.setUserId(userID)
Note
To ensure UserID is available and unique for all users, you should not use IDFA as an identifier.
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.ironSource supports three methods to convey data to our servers to outline the user segment, namely:
Device Properties: the ironSource 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
User Properties: user data which is not collected by our SDK (for example, age, gender, 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 ironSource platform
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 ironSource platform
Note
If you're using ironSource SDK 7.2.0+, you can use ISSegment 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 ironSource platform, you should inform our servers of the user's particulars.First, init the segment:
ISSegment *segment = [[ISSegment alloc]init];
let segment: ISSegment = ISSegment()
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, enter the segment name:
[segment setSegmentName:YOUR_SEGMENT_NAME];
segment.segmentName = "YOUR_SEGMENT_NAME"
Send us the user details. ironSource provides a range of standard user properties that you can set to attribute a user to a segment in the API. See table below for descriptions.
// Set user age
[segment setAge:USER_AGE];
// Set user gender
[segment setGender:USER_GENDER];
// 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];
// Set user age
segment.age = USER_AGE
// Set user gender
segment.gender = ISGender.IRONSOURCE_USER_FEMALE
// Set user's total in-app purchases
segment.iapTotal = USER_IAP_TOTAL
// Set user's level
segment.level = USER_LEVEL
// Set user's paying status
segment.paying = USER_PAYING_STATUS
// Set user creation date
segment.userCreationDate = NSDate() as Date!
In addition, you can set up to 5 custom user properties per segment:
The ironSource SDK supports custom parameters for Rewarded Video. You can pass custom parameters upon the initialization of the ad unit and receive the parameters upon a user's completion event.You can now pass custom parameters for all mediation networks on Unity LevelPlay.
Custom parameters work in conjunction with server-to-server completion callbacks only. You will receive the parameter as part of the callback string.
You may insert more than one custom parameter in the init request.
Implementation Code
Rewarded Video
Custom Parameters can be set several times per session.
To reset the value, use clearRewardedVideoServerParameters, and then set the new value.
Price limitations using waterfall configuration (beta)
Set Waterfall Configuration is an API that can be used to dynamically set limits for the waterfall: price ceiling and price floor. You can use it to set limits and dynamically affect the WF returned per user, resulting in reduced load times and latency. Limits include, and can be any combination of these parameters:
Properties
Type
Description
ceiling
double
The price in USD, which defines the maximal eCPM applies to traditional instances
floor
double
The price in USD, which defines the minimal eCPM applies to traditional instances and bidders
Create a waterfall configuration
The WaterfallConfiguration class represents a configuration object for customizing or filtering a waterfall. In order to create a waterfall configuration, define a WaterallConfigurationBuilder:
// define a WaterallConfigurationBuilderISWaterfallConfigurationBuilder *builder =[ISWaterfallConfiguration builder];// Build the WaterfallConfiguration and add data to constrain or control a waterfall[builder setCeiling:@ceiling];[builder setFloor:@floor];ISWaterfallConfiguration *configuration =[builder build];//set a configuration for an ad unit[IronSource setWaterfallConfiguration:configuration forAdUnit:[ISAdUnit IS_AD_UNIT_REWARDED_VIDEO]];
Clearing a Waterfall Configuration
It is possible to change the waterfall configuration during the session. To clear the configuration for a given ad unit, use the ISWaterfallConfiguration.clear() function.
A built WaterfallConfiguration is immutable, you must create a new Waterfall Configuration to change the existing configuration from a previous one. One may also inline the builder and set definitions in keeping with the builder pattern.
ironSource 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 ironSource 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