Documentation Index
Fetch the complete documentation index at: https://docs.encorekit.com/llms.txt
Use this file to discover all available pages before exploring further.
A data class for storing user metadata used in offer targeting, personalization, and analytics. All fields are optional and will be merged with existing attributes when set.
Structure
@JsonClass(generateAdapter = true)
data class UserAttributes(
val email: String? = null,
val firstName: String? = null,
val lastName: String? = null,
val phoneNumber: String? = null,
val postalCode: String? = null,
val city: String? = null,
val state: String? = null,
val countryCode: String? = null,
val latitude: String? = null,
val longitude: String? = null,
val dateOfBirth: String? = null,
val gender: String? = null,
val language: String? = null,
val subscriptionTier: String? = null,
val monthsSubscribed: String? = null,
val billingCycle: String? = null,
val lastPaymentAmount: String? = null,
val lastActiveDate: String? = null,
val totalSessions: String? = null,
val custom: Map<String, String> = emptyMap(),
)
Field Reference
Identity & Basic Info
| Field | Type | Format | Example | Description |
|---|
email | String? | email address | user@example.com | User’s email address |
firstName | String? | free-form string | Jane | User’s first name |
lastName | String? | free-form string | Doe | User’s last name |
phoneNumber | String? | E.164 or local | +442071838750 | User’s phone number |
Location
| Field | Type | Format | Example | Description |
|---|
postalCode | String? | postal/ZIP code | SW1A 1AA | Postal or ZIP code |
city | String? | free-form string | San Francisco | City name |
state | String? | abbr or full | CA | State/province |
countryCode | String? | ISO 3166-1 alpha-2 | US | Country code |
latitude | String? | decimal degrees | 37.7749 | Geographic latitude |
longitude | String? | decimal degrees | -122.4194 | Geographic longitude |
Demographics
| Field | Type | Format | Example | Description |
|---|
dateOfBirth | String? | ISO 8601 date | 1990-05-21 | User’s date of birth |
gender | String? | free-form string | female | User’s gender |
language | String? | ISO 639-1 | en | Preferred language |
Subscription & Billing
| Field | Type | Format | Example | Description |
|---|
subscriptionTier | String? | plan name | free, premium, pro | Current subscription plan/tier |
monthsSubscribed | String? | integer string | 6 | Number of months subscribed |
billingCycle | String? | enum string | monthly, annual | Billing frequency |
lastPaymentAmount | String? | decimal as string | 9.99 | Amount of last payment |
Engagement
| Field | Type | Format | Example | Description |
|---|
lastActiveDate | String? | ISO 8601 datetime | 2024-03-15T14:30:00Z | Timestamp of last activity |
totalSessions | String? | integer string | 42 | Total number of sessions |
Custom Attributes
| Field | Type | Format | Example | Description |
|---|
custom | Map<String, String> | key-value pairs | mapOf("churnRisk" to "high") | Any additional attributes not covered above |
Usage
val attributes = UserAttributes(
email = "user@example.com",
subscriptionTier = "premium",
monthsSubscribed = "6"
)
Encore.shared.setUserAttributes(attributes)