UserInfo

User Info #

Now you can set up and update user information in a simpler and clearer way.

API #

Call this method to update user information when users log in, and you can transfer more information through field customdata & usertags.

Besides, remember to clear the login user’s information by calling resetUserInfo() function when you detect a player logging out.

This API requires the following parameters:

  • UserConfig

    Required. Configuration for customize user information.

    Field Description Type Remark
    userId a unique identifier for current user String can not be 0 or -1, random number by default
    userName the display name for current user String anonymous by default
    serverId the server ID for current user String -1 by default
    userTags setting tags for user String split multiple tags by ‘,', null by default
    customData custom data to display in dashboard(jsonString String {“key”:“value”, “key”:“value”}, null by default
    isSyncCrmInfo sync user info to CRM boolean false by defalut

Note:

**For native iOS platform, the type of userTags is NSArray, while the type of customData is NSDictionary. **

For HTML5 platform, encapsulate all your needed fields into userConfig and pass in, and the type of customData is object.

See the code example for details.

Call this method to inform AIHelp when user logs out to ensure the accuracy for tourist-user’s information.

The API does not require any parameters.

Code example #

Let’s assume a scenario where you want to get some information about your users in the dashborad of AIHelp.

The details are as follows:

1、User level;

2、total recharge amount;

3、remaing bills;

Then, the code example for this scenario is as follows:

public void updateUserInfo() {
    JSONObject customData = new JSONObject();
    customData.put("level", 34);
    customData.put("total_recharge", 300);
    customData.put("remaining", 56);

    UserConfig userConfig = new UserConfig.Builder()
            .setUserId("123456789")
            .setUserName("AIHelper")
            .setUserTags("recharge,vip1,paid3")
            .setCustomData(customData.toString())
            .build();
    
    AIHelpSupport.updateUserInfo(userConfig);
}

For native IOS platforms, the type of userTags is NSArray, while the type of customData is NSDictionary.

- (void)updateUserInfo {
    AIHelpUserConfigBuilder *userBuilder = [[AIHelpUserConfigBuilder alloc] init];
    userBuilder.userId = @"123456789";
    userBuilder.userName = @"AIHelper";
    userBuilder.userTags = @[@"recharge", @"vip1", @"paid3"];
    userBuilder.customData = @{@"level":@34, @"total_recharge":@300, @"remaining":@"56"};
    [AIHelpSupportSDK updateUserInfo:userBuilder.build];
}
public void updateUserInfo() {
    UserConfig userConfig = UserConfigBuilder()
            .setUserId("123456789")
            .setUserName("AIHelper")
            .setUserTags("recharge,vip1,paid3")
            .setCustomData("{\"level\":34,\"total_recharge\":300,\"remaining\":56}")
            .build();
    
    AIHelpSupport::updateUserInfo(userConfig);
}
public void updateUserInfo() {
    JSONObject customData = new JSONObject();
    customData.put("level", 34);
    customData.put("total_recharge", 300);
    customData.put("remaining", 56);

    UserConfig userConfig = new UserConfig.Builder()
            .setUserId("123456789")
            .setUserName("AIHelper")
            .setUserTags("recharge,vip1,paid3")
            .setCustomData(customData.toString())
            .build();
    
    AIHelpSupport.updateUserInfo(userConfig);
}
<script src="https://aihelp.net/webchat/aihelp.js"></script>
<script>
    // Example for updateUserInfo case
    (function () {
        var userConfig = {
            userId: '123456789',
            userName: 'AIHelper',
            userTags: 'recharge,vip1,paid3',
            customData: {
                level: 34,
                total_recharge: 300,
                remaining: 56,
            },
        }
        var initConfig = {
            appKey: 'THIS IS YOUR APP KEY',
            domain: 'THIS IS YOUR APP DOMAIN',
            appId: 'THIS IS YOUR APP ID',
            appName: "THIS IS YOUR APP NAME(OPTIONAL)",
            language: 'THIS IS YOUR DEFAULT LANGUAGE(OPTIONAL)',
            supportMode: 'THIS IS YOUR SUPPORT MODE',
            userConfig: userConfig
        }
        if (typeof AIHelpSupport !== undefined) AIHelpSupport.init(initConfig);
    })();
    function openAIHelp() {
        if (typeof AIHelpSupport !== undefined) AIHelpSupport.show();
    }
</script>

After the configuration is completed, when the user submits a complaint, you can get this in the AIHelp dashboard:

Remark #

  • How to configure user tags

    When setting tags for users, you should ensure that the tags you are setting has been added in advance in the dashborad of AIHelp.