Android User Information

Tracking User Information

After you install SDK to your app, Reteno begins automatically collect such data:

  • Information about push message delivery and openings,
  • Users’ push tokens,
  • Screen view events,
  • Statuses of the users’ subscription to push notifications.

Reteno automatically creates user profiles with all these data, so you can immediately start working with new contacts, for example, sending them a mobile campaign.

When the user logs in or signs up to your app, you have to define a unique customer identifier that cannot be shared by other contacts. We call it External User Id or just User Id. The system will match all previous data with an external ID as the primary identifier and update the user’s profile.

Read more about system customer identifiers and their matching in the system >

External User ID

Add your custom External User Ids within Reteno by the following method:

Reteno.setUserAttributes(String externalUserId)
Reteno.setUserAttributes(externalUserId: String)

📘

Note

externalUserId should not be null or empty, or IllegalArgumentException will be thrown.

When to send your user ID to Reteno >

User Attributes

User attributes are attributes you define to describe segments of your user base, such as language preference or geographic location. Before sending specific contact data via API, you must add custom user fields to Reteno. Read more on how to set additional fields.

📘

Note

You can track user attributes only for users with external user IDs.

Add user attributes like phone, email, etc by the following method:

Reteno.setUserAttributes(String externalUserId, User user)
Reteno.setUserAttributes(externalUserId: String, user: User?)

📘

Note

externalUserId should not be null or empty, or IllegalArgumentException will be thrown.

User model:

{
   "userAttributes":{
      "phone":"String",
      "email":"String",
      "firstName":"String",
      "lastName":"String",
      "languageCode":"String",
      "timeZone":"String",
      "address":{
         "region":"String",
         "town":"String",
         "address":"String",
         "postcode":"String"
      },
      "fields":[
         {
            "key":"string",
            "value":"string"
         },
         {
            "key":"string",
            "value":"string"
         }
      ]
   },
   "subscriptionKeys":[
      "string1",
      "string2"
   ],
   "groupNamesInclude":[
      "string1",
      "string2"
   ],
   "groupNamesExclude":[
      "string",
      "string2"
   ]
}

The structure of models with optional and required fields:

data class User(
    val userAttributes: UserAttributes? = null,
    val subscriptionKeys: List<String>? = null,
    val groupNamesInclude: List<String>? = null,
    val groupNamesExclude: List<String>? = null
)

data class UserAttributes(
    val phone: String? = null,
    val email: String? = null,
    val firstName: String? = null,
    val lastName: String? = null,
    val languageCode: String? = null,
    val timeZone: String? = null,
    val address: Address? = null,
    val fields: List<UserCustomField>? = null,
)

data class Address(
    val region: String? = null,
    val town: String? = null,
    val address: String? = null,
    val postcode: String? = null
)

data class UserCustomField(
    val key: String,
    val value: String? = null
)

📘

Note

Phone

We use Google's libphonenumber library for phone number validation. Send phone numbers in the E164 format. A request with an invalid phone number will not be transmitted. You can validate phone numbers by the link.

LanguageCode

Data about language in RFC 5646 format. Primary language subtag in ISO 639-1 format is required. Example: de-AT

TimeZone

Item from TZ database. Example: Europe/Kyiv

Anonymous User Attributes

Available for RetenoSDK starting from version 1.5.3

Reteno SDK allows tracking anonymous user attributes (no externalUserId required). To set user attributes without externalUserId use method setAnonymousUserAttributes():

Reteno.setAnonymousUserAttributes(UserAttributesAnonymous attributes)
Reteno.setAnonymousUserAttributes(attributes: UserAttributesAnonymous)

UserAttributesAnonymous model:

data class UserAttributesAnonymous(
    /**
     *  Contact first name. Numbers cannot be used
     */
    val firstName: String? = null,
    /**
     * Contact last name. Numbers cannot be used
     */
    val lastName: String? = null,
    /**
     * Data about language in RFC 5646 format.
     * Primary language subtag in ISO 639-1 format is required.
     * Example: de-AT
     */
    val languageCode: String? = null,
    /**
     * Item from TZ database. Example: Europe/Kyiv.
     * See column [TZ database name](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
     */
    val timeZone: String? = null,
    /**
     * Contact full address
     *
     * @see Address
     */
    val address: Address? = null,
    /**
     * Additional field values for contact
     *
     * @see UserCustomField
     */
    val fields: List<UserCustomField>? = null,
)

📘

Note

You can't provide anonymous user attributes with phone or/and email. For that purpose use setUserAttributes() method with externalUserId.