Additional SDK Settings
GDPR – Managing Consent
ironSource’s mediation platform and network support publisher communication of a user’s consent choice, including passing this information to mediated networks (for supported networks).
To use ironSource’s API to update a user’s consent status, use this functions:
If the user provided consent, please set the following flag to true:
If the user did not consent, please set the following flag to false:
It’s recommended to set the API prior to SDK Initialization.
A detailed article regarding ironSource’s approach to GDPR and user consent can be found here.
If you’re serving the Offerwall ad unit or using server-to-server callbacks to reward your users with our rewarded ad units, you must set the UserID.
The userID is a unique identifier for each of your users. You can set the userID parameter, or omit it and let us generate one for you. If you choose to skip setting the userID in your code, the SDK will generate an equitable userID.
We support String (Android) or NSString (iOS) from 1 to 64 characters. Common practice is to use the Google Advertising ID (GAID) or Apple Advertising ID (IDFA). More information on User IDs can be found here.
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.
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 location, device model, device manufacturer, app version, OS, etc. You do not need to convey this data to us.
- User Properties: comprehensive user data such as age, gender, 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 ironSource 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’ve defined segments on the ironSource 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:
- If you are familiar with the segment that the user belongs to, enter the segment name:
IronSourceSegment segment = new IronSourceSegment (); segment.segmentName = "nameOfSegment";
- 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. Scroll down for a table of the support user segment properties.
// Create segment object IronSourceSegment segment = new IronSourceSegment (); // Set user age segment.age = age; // Set user gender segment.gender = "gender"; // Set user's level segment.level = levelnumber; // Set user creation date segment.userCreationDate=creationData // Set user's total in-app purchases segment.iapt = numberOfInAppPurchases; // Set user's paying status, 1 is yes 0 is no segment.isPaying = payingStatus;
In addition, you can set up to 5 custom user properties per segment:
// Set custom parameters (up to 5) Dictionary<string,string> customParams = new Dictionary<string,string> (); customParams.Add ("customKey", "value"); segment.customs = customParams;
Next, to serve your ad units based on segments to tailor the user’s ad experience, call the following function complete with either the segment name or user properties:
Supported User Segment Properties
||The given name of the segment in your ironSource account|
|Age||Int||1-99||The user’s age|
|Gender||String||female or male||The user’s gender|
|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, e.g. [NSDate date]|
|Custom Parameters||key=string, value=string||
||Any 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 ironSource Segment module.
IronSourceEvents.onSegmentReceivedEvent += SegmentReceivedEvent;
Custom Parameters for Unity
The ironSource SDK supports custom parameters for Rewarded Video and Offerwall. You can pass custom parameters upon the initialization of the ad unit and receive the parameters upon a user’s completion event.
New! You can now pass custom parameters for all mediation networks on the ironSource mediation platform.
- 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.
- Custom Parameters can be added once per session for Rewarded Video.
- Custom Parameters should be called before initiating the Rewarded Video.
public void setRewardedVideoServerParams(Dictionary<string, string> parameters) public void clearRewardedVideoServerParams()
- Custom Parameters should be called before calling showOfferwall.
Dictionary<string, string> owParams = new Dictionary<string, string>(); owParams.Add(“key1”, “value1"); owParams.Add(“key2”, “value2"); IronSourceConfig.Instance.setOfferwallCustomParams (owParams);
For example, if you’d like to receive the IP of a user who engaged with the Offerwall, you can add this as an additional parameter in the completion callback:
Dictionary<string, string> owParams = new Dictionary<string, string>(); owParams.Add("ip", "126.96.36.199"); IronSourceConfig.Instance.setOfferwallCustomParams (owParams);
You will then receive a corresponding callback as exemplified below:
ironSource SDK Error Codes
ironSource provides an error feedback mechanism to provide 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:
|Load Fail: Error Codes||Product||Description|
|520||Interstitial||Interstitial Load Fail – No internet connection|
|526||Interstitial||Interstitial Load Fail – Ad unit has reached its daily cap per session|
|Show Fail: Error Codes||Product||Description|
|526||Rewarded Video||Rewarded Video Show Fail – Ad unit has reached its daily cap per session|