userData

Countly. userData

Source:

Control user related custom properties. Don't forget to call save after finishing manipulation of custom data

Example

//set custom key value property
Countly.userData.set("twitter", "hulk@rowboat");
//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) increment(key)

Source:

Increment value under the key of this user's custom properties by one

Parameters:
Name Type Description
key string

name of the property to attach to user

(static) increment_by(key, value)

Source:

Increment value under the key of this user's custom properties by provided value

Parameters:
Name Type Description
key string

name of the property to attach to user

value number

value by which to increment server value

(static) max(key, value)

Source:

Save maximal value under the key of this user's custom properties

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)

Source:

Save minimal value under the key of this user's custom properties

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) multiply(key, value)

Source:

Multiply value under the key of this user's custom properties by provided value

Parameters:
Name Type Description
key string

name of the property to attach to user

value number

value by which to multiply server value

(static) pull(key, value)

Source:

Remove value from array under the key of this user's custom properties

Parameters:
Name Type Description
key string

name of the property

value string | number

value which to remove from array

(static) push(key, value)

Source:

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

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)

Source:

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

Parameters:
Name Type Description
key string

name of the property to attach to user

value string | number

value which to add to array

(static) save()

Source:

Save changes made to user's custom properties object and send them to server

(static) set(key, value)

Source:

Sets user's custom property value

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)

Source:

Sets user's custom property value only if it was not set before

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)

Source:

Unset/deletes user's custom property

Parameters:
Name Type Description
key string

name of the property to delete