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:
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.
Function
export function userPropertiesInit(properties:Object);
Parameter | Description | Type | Required |
---|---|---|---|
properties | Developer custom user properties | Object | Yes |
Sample Code
let properties = {"properties_key":" properties value"};
SolarEngine.userPropertiesInit(properties);
For general user properties, you can call userUpdate to set them. The properties uploaded in this way will overwrite the original property values. If the user properties does not exist before, it will be created, and the data type will follow the value passed in.
Function
export function userPropertiesUpdate(properties:Object);
Parameter | Description | Type | Required |
---|---|---|---|
properties | Developer custom user properties | Object | Yes |
Sample Code
let properties = {"update_key":" update value"};
SolarEngine.userPropertiesUpdate(properties);
If you want to report a numeric property and accumulate its values, you can call userAdd. If the property 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.
Function
export function userPropertiesAdd(properties:Map<string,number>);
Parameter | Description | Type | Required |
---|---|---|---|
properties | Developer custom user properties | Map<string,number> | Yes |
Sample Code
let map = new Map<string, number>();
map.set('key1', 1.14);
map.set('key2', 2.14);
map.set('key3', 3.14);
SolarEngine.userPropertiesAdd(map);
Note:
This method only performs the addition operation for key values whose value type is numeric.
When you want to clear the user property values of a user, you can call userUnset to clear the specified property (string array). If the property has not been created in the array, the property will not be created.
Function
export function userPropertiesUnset(eventNames:Array<string>);
Parameter | Description | Type | Required |
---|---|---|---|
eventNames | Array of string keys for user properties that need to be cleared | Array<string> | Yes |
Sample Code
let keys:Array<string> = ["key_name1","key_name2","key_name3"];
SolarEngine.userPropertiesUnset(keys);
You can call userAppend to append user properties of array type. If the property does not exist, it will be created.
Function
export function userPropertiesAppend(properties:Object);
Parameter | Description | Type | Required |
---|---|---|---|
properties | Developer custom user properties | Dictionary | Yes |
Sample Code
let properties = {"append_key":"append value"};
SolarEngine.userPropertiesAppend(properties);
You can call userDelete to delete users. After a user is deleted, you will no longer be able to query the user's user properties, but the events generated by the user can still be queried.
Function
export function userPropertiesDelete(deleteType:SEUserDeleteType);
export enum SEUserDeleteType {
ByAccountId = 1,
ByVisitorId = 2,
}
Sample Code
let type:SEUserDeleteType = SEUserDeleteType.ByVisitorId;
SolarEngine.userPropertiesDelete(type);