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.

userPropertiesInit

      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);
ParameterDescriptionTypeRequired
propertiesDeveloper custom user propertiesObjectYes

Sample Code

let properties = {"properties_key":" properties value"};
SolarEngine.userPropertiesInit(properties);

userPropertiesUpdate

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);
ParameterDescriptionTypeRequired
propertiesDeveloper custom user propertiesObjectYes

Sample Code

let properties = {"update_key":" update value"};
SolarEngine.userPropertiesUpdate(properties);

userPropertiesAdd

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>);
ParameterDescriptionTypeRequired
propertiesDeveloper custom user propertiesMap<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.

userPropertiesUnset

      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>);
ParameterDescriptionTypeRequired
eventNamesArray of string keys for user properties that need to be clearedArray<string>Yes

Sample Code

let keys:Array<string> = ["key_name1","key_name2","key_name3"];
SolarEngine.userPropertiesUnset(keys);

userPropertiesAppend  

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);
ParameterDescriptionTypeRequired
propertiesDeveloper custom user propertiesDictionaryYes

Sample Code

let properties = {"append_key":"append value"};
SolarEngine.userPropertiesAppend(properties);

userPropertiesDelete

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);


Previous
First-Time Event
Next
iOS ATT Authorization
Last modified: 2024-12-05Powered by