Users
In order to track your authenticated users through their navigation, you can set their identifiers once and our SDKs will automatically send the dedicated properties in each events.
Our SDKs will store these identifiers client-side by default. You can however disable this feature when calling the method.
Set user identifiers
- Javascript
- Android
- Apple
Method:
pa.setUser(userId[, userCategory, enableStorage])
Parameters | Type | Description |
---|---|---|
userId | string | User identifier |
userCategory | string | User category |
enableStorage | boolean | Indicates whether the identifiers should be stored (true - default) or not (false ) |
pa.setUser('WEB-192203AJ', 'premium', false);
Method:
func PianoAnalytics.setUser(id) -> void
func PianoAnalytics.setUser(id,category) -> void
func PianoAnalytics.setUser(id,category,enableStorage) -> void
Parameters | Type | Description |
---|---|---|
id | String | User identifier |
category | String | User category |
enableStorage | Boolean | Indicates whether the identifiers should be stored (true - default) or not (false ) |
pa.setUser("WEB-192203AJ", "premium", false);
Method:
pa.setUser(_ id: String, category: String? = nil, enableStorage: Bool = true)
Parameters | Type | Description |
---|---|---|
id | String | User identifier |
category | String? | User category |
enableStorage | Bool | Indicates whether the identifiers should be stored (true - default) or not (false ) |
pa.setUser("WEB-192203AJ", category: "premium", enableStorage: false);
Retrieve user data
You can retrieve user data thanks to a dedicated method
- Javascript
- Android
- Apple
Method:
pa.getUser(callback)
Parameters | Type | Description |
---|---|---|
callback | function | Callback of the method |
pa.getUser(function(userData) {
console.log('User: ' + userData.id + ', Category: ' + userData.category)
});
Method:
func PianoAnalytics.getUser(PianoAnalytics.OnGetUserListener) -> void
pa.getUser(user -> {
// do something with user
});
Method:
pa.getUser(completionHandler: ((_ user: User?) -> Void)?)
pa.getUser { user in
print(user?.id)
print(user?.category)
}
Delete user data
You can delete user data thanks to a dedicated method
- Javascript
- Android
- Apple
Method: pa.deleteUser()
pa.deleteUser();
Method: func PianoAnalytics.deleteUser() -> void
pa.deleteUser();
Method: pa.deleteUser()
pa.deleteUser();