Additional SDK Settings for Android

Set UserID

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.

 In the case you want to define the userID manually, you must do this before the init request. You cannot define the userID after the init request.

The userID is a unique identifier for each of your users. We support NSString from 1 to 64 characters. More information on User IDs can be found here.

IronSource.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.

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, OS, etc. You do not need to convey this data to us
  • User Properties: user data which is not collected by our SDK, 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 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 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.

Segments must be set before initializing the SDK.

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:
    mIronSegment.setSegmentName(name);
  2. 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
    mIronSegment = new IronSourceSegment();
    // Set user age
    mIronSegment.setAge(age);
    // Set user gender
    mIronSegment.setGender(gender);
    // Set user's level
    mIronSegment.setLevel(level);
    // Set user creation date
    mIronSegment.setUserCreationDate(date);
    // Set user's total in-app purchases
    mIronSegment.setIAPTotal(iapt);
    // Set user's paying status
    mIronSegment.setIsPaying(isPaying);
    

    In addition, you can set up to 5 custom user properties per segment:

    // Set custom parameters (up to 5)
    mIronSegment.setCustom(key,value);
    

Next, to serve your ad units based on segments, call the following function complete with either the segment name or user properties:

IronSource.setSegment(mIronSegment);

Supported User Segment Properties

Segment Properties Type Limitation Description
segmentName String
  • alphanumeric
  • up to 32 letters
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
  • 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, e.g. [NSDate date]
Custom Parameters key=string, value=string
  • ironSource supports up to 5 custom parameters
  • alphanumeric
  • up to 32 letters
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.

SegmentListener onSegmentReceived(String segment){}