Managing customer profiles

The Medio Platform allows you to include information about your users in an individualized profile called a Common Customer Profile (CCP). You can include information such as date of birth, gender, and other user preference settings to see reports on user profiles and to target users with relevant content, even across different devices and applications. The SDK provides APIs to easily manage attributes in these profiles.

Setting a user ID

If your application has a unique ID for each user such as a numeric ID or username, then we recommend that you set each user’s ID to ensure the most accurate reporting. Setting a user ID also ensures that your users receive the most relevant content if your application requests content from Medio. You can set a user’s unique ID using the EventAPI.setUserId method:


We recommend that you hash your user IDs before setting them if they contain any personally identifiable information. If you don’t set a user ID then we’ll use an automatically generated anonymous ID in combination with other factors to identify that user.

Setting single-valued attributes

Let’s say that your application has a preferences view that allows users to set their favorite color. You can set the selected color in a “favoriteColor” attribute using the UserAttributes.set method:

EventAPI.userAttributes().set("favoriteColor", "green");

Setting multi-valued attributes

You can also set attributes that contain a list of multiple values. For example, if you allow your users to specify multiple favorite colors as a preference, use the UserAttributes.set method and pass in multiple values for a “favoriteColors” attribute:

EventAPI.userAttributes().set("favoriteColors", "green", "blue", "orange");

Note that the SDK updates multi-valued attributes by replacing all values with the last specified values. For example:

EventAPI.userAttributes().set("favoriteColors", "green", "blue", "orange");
// favoriteColors contains the values ["green", "blue", "orange"]

EventAPI.userAttributes().set("favoriteColors", "red", "yellow");
// favoriteColors now contains the values ["red", "yellow"]

Setting gender

Use the constant UserAttributes.GENDER as the attribute name when setting a user’s gender and use the constant UserAttributes.GENDER_MALE or UserAttributes.GENDER_FEMALE when specifying male or female values. For example, you can set the user’s gender to female using the following code:

EventAPI.userAttributes().set(UserAttributes.GENDER, UserAttributes.GENDER_FEMALE);

Setting date of birth

Use the constant UserAttributes.DATE_OF_BIRTH as the attribute name with the UserAttribute.setDate method when setting a user’s date of birth. For example, you can set the user’s date of birth to January 1, 1980 using the following code:

EventAPI.userAttributes().setDate(UserAttributes.DATE_OF_BIRTH, 1980, 1, 1);

Removing attributes

You can remove attributes from a user’s profile using the UserAttributes.unset method. For example, you can remove the “favoriteColor” attribute from a user’s profile using the following code:


The UserAttributes.unset method removes both single-valued and multi-valued attributes from a user’s profile.