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.

Setting Properties

For each of the properties listed below, there’s a corresponding getters / setters. For example, you can set the age property using:

FyberSdk.instance.getUser.age = 12;

While you can get its value using:

FyberSDK.instance.getUser.age;

Properties List

The full list of properties are shown here:

Property Type Description  
iap Boolean Sets if in-app purchases are enabled.  
iapAmount Number The amount of money the user has spent.  
psTime Number The time spent on the current session.  
lastSession Number The duration of the last session.  
connectionType String The connection type used by the user.  
device String The device used by the user.  
version String The version of the app that’s currently executed.  
age int Age of the user.  
interests Array List of interests of the user.  
birthdate Date The date of the user’s birth.  
customParameters Dictionary The custom parameters that could be set.  

Predefined Segments

The Adobe Air SDK supports predefined values for the following user segments: gender, device, sexualOrientation and connection type. Predefined values are supported as constants defined in the User class.

Gender

Class Constants
User GenderMale
  GenderFemale
  GenderOther

Connection

Class Constants
User ConnectionTypeWiFi
  ConnectionType3G

Sexual Orientation

Class Constants
User SexualOrientationStraight
  SexualOrientationBisexual
  SexualOrientationGay
  SexualOrientationUnknown

Device

Class Constants
User DeviceUndefined
  DeviceIPhone
  DeviceIPad
  DeviceIPod

Adding a Custom Value

We provide the customParameters method for adding a custom value. The key-value-pairs you have provided will be set in the dictionary as long as the provided keys don’t match with any reserved keys. Reserved keys are presented on the Property column on the table above.

Available data types:

Data type Description Example
int whole numbers "123"
Number number with decimal point "123.4"
Boolean true/false "true"
String any string input "foobar"
Array comma-separated string input "foobar, foobar2"

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

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

var date:Date = new Date();
var fyberDate:Number = date.getTime();