Skip to main content

Passing User Data to SDK

SDK Version Selection

Choose your SDK version below:

  • Apptrove SDK → Recommended for all projects (Latest: v2.0.0)
  • Trackier SDK → Will be deprecated in May 2026 (v1.x.xx)

Use the tabs below to view user data code for your chosen SDK.

The SDK allows you to pass user identification data and additional attributes that can be correlated with your analytics data. This enables user-level tracking and more detailed reporting.

Implementation Methods

User Details Example

private void userDetails() {

// Create a new AppTrove event
AppTroveEvent event = new AppTroveEvent("sEMWSCTXeu");

// Set core user identifiers
AppTroveSDK.setUserId("XXXXXXXX"); // Unique user identifier
AppTroveSDK.setUserEmail("abc@gmail.com"); // User email address
AppTroveSDK.setUserName("abc"); // User display name
AppTroveSDK.setUserPhone("983293829"); // User phone number

// Set additional custom attributes
HashMap<String,Object> userDetails = new HashMap<>();
userDetails.put("Name", "Sanu"); // Full name
userDetails.put("UserMobile", "873287XXXX");// Mobile number

AppTroveSDK.setUserAdditionalDetails(userDetails);

// Track the event with user context
AppTroveSDK.trackEvent(event);
}

Supported User Data Fields

Basic User Information

  • setUserId(String) - Unique identifier for the user
  • setUserEmail(String) - User's email address
  • setUserName(String) - User's display name
  • setUserPhone(String) - User's phone number

Additional Custom Attributes

  • setUserAdditionalDetails(Map) - Key-value pairs for any additional user data

Best Practices

  1. Consistency: Use the same user ID across all platforms and sessions
  2. Privacy: Only collect data with proper user consent
  3. Timing: Set user data before tracking any user-specific events
  4. Updates: Refresh user data when information changes
  5. Security: Never store sensitive information like passwords

note

User data helps create more accurate attribution models and enables user-level analytics in your dashboard.

For more information, refer to the SDK Documentation.