getProfileAttributes

The getProfileAttributes() method returns the Data Activation profile attributes of the user. You can only access attributes that are enabled for public access in Data Activation.

Syntax

PiwikTracker.sharedInstance()?.getProfileAttributes { profileAttributes, error in
    // do something with attribute list
}
[[PiwikTracker sharedInstance] getProfileAttributesWithCompletionBlock:^(NSDictionary<NSString *, id> * _Nullable profileAttributes, NSError * _Nullable error) {
    // do something with attribute list
}];

Callback parameters

  • profileAttributes NSDictionary?, output – A dictionary of attribute name-value pairs. Values can be NSString, NSNumber (including booleans), or NSArray. Attributes with null values are skipped.

  • error NSError?, output – The error object, if any.

Examples

To get the user's profile attributes:

PiwikTracker.sharedInstance()?.getProfileAttributes { profileAttributes, error in
    // Do something with the attribute list
}
[[PiwikTracker sharedInstance] getProfileAttributesWithCompletionBlock:^(NSDictionary<NSString *, id> * _Nullable profileAttributes, NSError * _Nullable error) {
    // Do something with the attribute list
}];

Notes

  • You can only access attributes that are enabled for public access in Data Activation.
  • The user profile is identified by the visitor ID. Set isAnonymizationEnabled to false so the SDK keeps the same visitor ID between app launches. Otherwise, it generates a new visitor ID each time the app starts and may not find the existing profile.
  • The completion block is called asynchronously on the main thread.
  • When optOut is true, the SDK doesn't send the request and calls the completion block with an error.

Related methods


Did this page help you?