Menu

Set User Property

SolarEngine provides multiple methods for reporting user properties. You can use these methods to add or modify user properties.

It is recommended for you to select properties that change infrequently or hold significant value, for example, age, game level, location, first payment time and total payment amount. Other properties with higher change frequency can be reported and recorded through events.

User property settings can be set by calling userUpdate, userInit, userAdd, userUnset, userAppend, or userDelete.

Note:

  1. The format requirements of user properties are consistent with those of event properties.
  2. Please do not report properties whose keys start with an underscore "_". The SDK will discard properties like this by default.

userInit

      If you want to upload a batch of user attributes, among which the existing user attributes will not update their values, and the non-existing attributes will be created and saved, you can call userInit to set them.

Parameter NameParameter MeaningParameter TypeRequired
userPropertiesDeveloper custom user propertiesObjectYes

Code Example

let properties = {
		name: "SolarEngine",
		age: 18,
		city:"beijing",
		customProperties:{
			test_key1:"1",
			test_key2:2,
		}
	}

solarengine.userInit(properties);

userUpdate

For general user attributes, you can call userUpdate to set them. The attributes uploaded in this way will overwrite the original attribute values. If the user attribute does not exist before, it will be created, and the data type will follow the value passed in.

Parameter NameParameter MeaningParameter TypeRequired
userPropertiesDeveloper custom user propertiesObjectYes

Code Example

let properties = {
		name: "热力",
		age: 20,
		city:"beijing",
		customProperties:{
			test_key1:"2",
			test_key2:20,
		}
	}

solarengine.userUpdate(properties);

userAdd

If you want to report a numeric attribute and accumulate its values, you can call userAdd. If the attribute has not been set, it will be assigned a value of 0 and then calculated. You can pass in a negative value, which is equivalent to a subtraction operation.

Parameter NameParameter MeaningParameter TypeRequired
userPropertiesDeveloper custom user propertiesObjectYes

Code Example

let properties = {
		number: 100,
		age: 20,
		city:"beijing"
	}

solarengine.userAdd(properties);

Note:

      The value called by userAdd only allows Number type.

userUnset

      When you want to clear the user attribute values of a user, you can call userUnset to clear the specified attributes (string array). If the attribute has not been created in the array, the attribute will not be created.

Parameter NameParameter MeaningParameter TypeRequired
keysA string of user property keys to be clearedarrayYes

Code Example

let properties = ["name","age"];
solarengine.userUnset(properties);

userAppend  

You can call userAppend to append user attributes of array type. If the attribute does not exist, it will be created.

Parameter NameParameter MeaningParameter TypeRequired
userPropertiesDeveloper custom user propertiesObjectYes

Code Example

let properties = {
		name: "热力",
		age: 20,
		city:"Beijing",
		customProperties:{
			test_key1:"2",
			test_key2:20,
		}
	}

solarengine.userAppend(properties);

userDelete

You can call userDelete to delete users. After a user is deleted, you will no longer be able to query the user's user attributes, but the events generated by the user can still be queried.

Parameter NameParameter MeaningParameter TypeRequired
deleteTypebyAccountId: (delete account ID)

byVisitorId: (delete visitor ID)
stringYes

Code Example

// delete account
solarengine.userDelete("byAccountId");

//  delete visitor
solarengine.userDelete("byVisitorId");


Previous
First-Time Event
Next
Event Reporting
Last modified: 2025-09-23Powered by