userData
- Description:
- Control user related custom properties. Don't forget to call save after finishing manipulation of custom data
- Source:
Example
//set custom key value property
Countly.userData.set("twitter", "ar2rsawseen");
//create or increase specific number property
Countly.userData.increment("login_count");
//add new value to array property if it is not already there
Countly.userData.push_unique("selected_category", "IT");
//send all custom property modified data to server
Countly.userData.save();
Methods
(static) set(key, value)
- Description:
- Sets user's custom property value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to attach to user |
value |
string | number | value to store under provided property |
(static) set_once(key, value)
- Description:
- Sets user's custom property value only if it was not set before
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to attach to user |
value |
string | number | value to store under provided property |
(static) unset(key)
- Description:
- Unset's/delete's user's custom property
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to delete |
(static) increment(key)
- Description:
- Increment value under the key of this user's custom properties by one
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to attach to user |
(static) increment_by(key, value)
- Description:
- Increment value under the key of this user's custom properties by provided value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to attach to user |
value |
number | value by which to increment server value |
(static) multiply(key, value)
- Description:
- Multiply value under the key of this user's custom properties by provided value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to attach to user |
value |
number | value by which to multiply server value |
(static) max(key, value)
- Description:
- Save maximal value under the key of this user's custom properties
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to attach to user |
value |
number | value which to compare to server's value and store maximal value of both provided |
(static) min(key, value)
- Description:
- Save minimal value under the key of this user's custom properties
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to attach to user |
value |
number | value which to compare to server's value and store minimal value of both provided |
(static) push(key, value)
- Description:
- Add value to array under the key of this user's custom properties. If property is not an array, it will be converted to array
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to attach to user |
value |
string | number | value which to add to array |
(static) push_unique(key, value)
- Description:
- Add value to array under the key of this user's custom properties, storing only unique values. If property is not an array, it will be converted to array
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property to attach to user |
value |
string | number | value which to add to array |
(static) pull(key, value)
- Description:
- Remove value from array under the key of this user's custom properties
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | name of the property |
value |
string | number | value which to remove from array |
(static) save()
- Description:
- Save changes made to user's custom properties object and send them to server
- Source: