Hello 👋 How can we help?

Collect and track user data

Here's how you can collect and track your iOS users' data in HelpCrunch.
Written by Andrew
Updated 2 weeks ago

By default, the HelpCrunch SDK doesn’t require users to enter any of their information before starting a chat conversation with you. You can send user data by yourself or enable our Welcome screen (TODO) with the attributes that you want users to enter.

Sending User attributes

Saving app user data to HelpCrunch is done by creating the HCSUser object and passing it to [HelpCrunch updateUser:completion:] or [HelpCrunch initWithConfiguration:user:completion:].

Be sure to add unique User ID strings to the userId property for all your users. Constructing empty users with no data will not work (after all, you will have no use of an empty user you cannot identify).

ObjC:

HCSUser *user = [HCSUser new];
user.userId = @"UserId";
user.name = @"Name";
user.email = @"Email";
user.phone = @"Phone";
user.company = @"Company";
user.customData = @{
    @"CustomKey1": @"CustomObject1",
    @"CustomKey2": @"CustomObject2",
    @"CustomKey3": @"CustomObject3"
  };

[HelpCrunch updateUser:user completion:^(NSError * _Nullable error) {}];

Swift:

let user = HCSUser()
user.userId = "UserId"
user.name = "Name"
user.email = "Email"
user.phone = "Phone"
user.company = "Company"
user.customData = ["CustomKey1": "CustomObject1",
                   "CustomKey2": "CustomObject2",
                   "CustomKey3": "CustomObject3"]

HelpCrunch.update(user)

You can also pass user data when initializing HelpCrunch in your application:

ObjC:

[HelpCrunch initWithConfiguration:configuration
                             user:user
                       completion:^(NSError * _Nullable error) {}];

Swift:

HelpCrunch.initWith(configuration, user: user)

After you have added user’s data, it will appear in your HelpCrunch admin panel right in a chat window:

In addition to user’s name / email / company / phone and ID, HelpCrunch lets you send additional customer attributes as custom data.

With the customData property, you can send any user information you wish to track. Custom data is key/value pairs and can contain numbers, strings or boolean data. You can associate a specific user of your application with a specific HelpCrunch chat using the withUserId option.

 ObjC:

HCSUser *user = [HCSUser new];
user.userId = @"UserId";
user.customData = @{
    @"CustomKey1": @"CustomObject1",
    @"CustomKey2": @"CustomObject2",
    @"CustomKey3": @"CustomObject3"
  };

[HelpCrunch updateUser:user completion:^(NSError * _Nullable error) {}];

 Swift:

let user = HCSUser()
user.userId = "UserId"
user.customData = ["CustomKey1": "CustomObject1",
                   "CustomKey2": "CustomObject2",
                   "CustomKey3": "CustomObject3"]

HelpCrunch.update(user)

Custom data parameters will appear in a chat window in your HelpCrunch admin panel just like main user attributes (name, email, user id) do:

Also, you will be able to use custom data for searching through your Contacts' list. There are 3 types of custom data you can search by: integers, strings and boolean:

Did this answer your question?