getProfileAttributes

The getProfileAttributes() method returns the user's Data Activation profile attributes. Only attributes enabled for public access in Data Activation are returned.

Syntax

tracker.getProfileAttributes(
    { attributes ->
        // handle result
    },
    { errorMessage ->
        // handle error
    }
)
getTracker().getProfileAttributes(
        attributes -> {
            // handle result
        },
        errorMessage -> {
            // handle error
        });

Parameters

onResult (required)

A callback with the map of key-value pairs. Each key is an attribute name and each value can be a String, Number, Boolean or List.

onError (required)

A callback that receives an error message.

Examples

To get the user's profile attributes:

tracker.getProfileAttributes(
    { attributes ->
        // Do something with the attributes
    },
    { errorMessage ->
        // Handle error
    }
)
getTracker().getProfileAttributes(
        attributes -> {
            // Do something with the attributes
        },
        errorMessage -> {
            // Handle error
        });

Notes

  • You can only access the attributes that are enabled for public access in Data Activation.
  • The user profile is identified by the visitor ID. Call setAnonymizationState(false), otherwise the SDK generates a new visitor ID each time the app starts and may not find the existing profile.
  • Either onResult or onError is called asynchronously on the main thread.
  • If setOptOut(true) is set, the SDK doesn't send the request and calls onError.

Related methods


Did this page help you?