User segmentation

Through the SDK’s User class, we allow you to send us data related to the user. After being sent to our servers, the data is analyzed and used at a later time when serving campaigns.

For each one of the properties below, there’s a correspondent call to set and get the value. For example, you can set the age property using

User.SetAge(12)

While you can get its value using:

User.GetAge()

The full list of properties can be found below:

Property Type Description
iap Boolean Sets if in-app purchases are enabled.
iap_amount float The amount of money that the user has spent.
number_of_sessions int The number of sessions that had already been started.
ps_time long The time spent on the current session.
last_session long The duration of the last session.
connection SPUserConnectionType The connection type used by the user.
device String The device used by the user.
app_version String The version of the app that’s currently executed.
age int Age of the user.
interests String[] List of interests of the user.
custom parameters String The custom parameters that could be set.

Predefined segments

Fyber’s SDK is supporting predefined values for the following user segments: gender, connection type, sexual orientation, marital status, education and ethnicity. Predefined values are supported as enumerators.

Enumerator Constants
UserGender male
  female
  other
UserConnection wifi
  3g
UserSexualOrientation straight
  bisexual
  gay
  unknown
UserMaritalStatus single
  relationship
  married
  divorced
  engaged
UserEducation other
  none
  high_school
  in_college
  some_college
  associates
  bachelors
  masters
  doctorate
UserEthnicity asian
  black
  hispanic
  indian
  middle_eastern
  native_american
  pacific_islander
  white
  other

Add custom value

Regarding the custom values, we are providing the PutCustomValue(string key, string value) method. The value that you have provided as a parameter on this method will be set in the dictionary, as long as the provided key doesn’t match with any of the reserved ones. Reserved keys are presented on the Property column on the table above.

Available data types are:

Data type Description Example
int whole numbers "123"
float number with decimal point "123.4"
boolean true/false "true"
daterange Date expressed as UNIX time. "1423958400" for 15/02/2015
string any string input "foobar"

Note: All values should be sent as a string, as the conversion to a specific data type happens on the server.

To convert a DateTime value to UNIX time format, you can use the following example:

 private int ConvertToTimestamp(DateTime value)
 {
     TimeSpan span = (value - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime());

     return (int)span.TotalSeconds;
 }