Skip to main content

Overview

Encore requires user identification to track entitlements and prevent abuse across devices. You can also set user attributes to enable targeted offers and personalization.

Anonymous Users

Encore automatically generates a random user ID that persists until the user clears app data, uninstalls, or calls reset(). This anonymous ID is stored locally and allows entitlement tracking to work immediately without requiring explicit user identification. The auto-generated ID is a standard UUID (e.g., 550e8400-e29b-41d4-a716-446655440000). You can call Encore.shared.reset() to reset this ID and clear any cached data.

Identified Users

If you use your own user management system, call identify() when you have a user’s identity:
A blank or whitespace-only userId is ignored and never persists; the current identity is left untouched and the SDK logs a warning. This enables the SDK to:
  • Associate promotional access with your user account
  • Sync entitlements across devices when the user logs in
  • Track conversion attribution accurately

Resetting User Identity

When a user logs out, call reset():
This will:
  • Reset the user ID to a new auto-generated anonymous ID
  • Clear cached configuration data
Your registered purchase controller survives reset(): it is app infrastructure, not user state, so logging a user out does not require re-registering it.

Setting User Attributes

Strongly recommended. Country and language already shape which offers a user is shown. Once you know who the user is, send what your app already knows, such as country and anything of your own in custom. Gender is accepted only from an app rated 18+ in its store listing, so leave it out otherwise.
Encore follows the device language. If your app has its own language picker, also call setLanguage with the user’s choice.
Only pass what you have a lawful basis to share, such as the user’s consent. Pass the user’s age in whole years as age, or their date of birth as dateOfBirth (YYYY-MM-DD), whichever your app has. The SDK works the age out on the device and never sends the date; given both, it uses the lower age. If you hold only a range, send its lowest end as age. A user under 18 is still served offers, from age-appropriate inventory only and with no per-user personalization. See Sending an age.
User attributes enable:
  • Personalized offers based on user data (subscription tier, usage, etc.)
  • Audience targeting with specific offers in the Encore dashboard
  • Conversion context tracking for analytics

Usage

Set attributes using the UserAttributes class. Every value is a string except age, a whole number of years; dateOfBirth is a YYYY-MM-DD string. Use the custom map, which takes strings, for app-specific fields:
You can also set user attributes when identifying:
Important: setUserAttributes() merges with existing attributes; it does not replace them.

Implementation Examples

With Login

Jetpack Compose with Login

Apps Without Login

If your app doesn’t require users to log in, you don’t need to do anything special:

Next Steps

  • Present Offers - Present a reward sheet at a moment your user just earned, and read the result
  • Add Subscription Product - Reduce Churn only: create a Google Play subscription product and connect it to Encore