Hello 👋 How can we help?

Custom Data

Written by Artem
Updated 1 month ago

HelpCrunch widget allows to collect your users’ data and use it inside your HelpCrunch account. You can pass the user’s data during the widget initialization (as we did with user authentication mode) or you can send it manually: 

Update main user attributes

You can update main attributes of your customer at any time by calling an updateUser method: 

var user = {
  email: '<user email / email>',
  name: '<user name / string>',
  user_id: '<user id / string>',
  phone: '<phone number / string>'
};
HelpCrunch('updateUser', user);

After you have added user’s data and called HelpCrunch('updateUser', user); this data will appear at your HelpCrunch admin account in chat with that user:

Add custom attributes to meet specific business criteria

In addition to the user’s name / email / ID, HelpCrunch lets you send additional attributes of your customers in custom data. You can do that by calling updateUserData method: HelpCrunch('updateUserData', userData);.
In userData you can send any information about users you wish to track as object of key/value pairs, that can contain numbers, strings or boolean data. This feature will only work if your user has a user_id attribute:

var userData = {
  money_spent: 2500,
  subscription: 'gold',
  accepted_agreement: true,
};
HelpCrunch('updateUserData', userData);

You can combine sending main attributes and custom data in one updateUser call:

var user = {
  email: '<user email / email>',
  name: '<user name / string>',
  user_id: '<user id / string>',
  phone: '<phone number / string>',
  custom_data: {
    money_spent: 2500,
    subscription: 'gold',
    accepted_agreement: true,
  },
};
HelpCrunch('updateUser', user);

You can also combine it right at the chat initialization method to make even less server calls:

var helpCrunchOptions = {
  applicationId: <application id>,
  applicationSecret: '<application secret>',
};
if (someAuthCheckMethodOfYourWebsite()) {
  helpCrunchOptions.user = {
    email: '<user email / email>',
    name: '<user name / string>',
    phone: '<phone number / string>',
    user_id: '<user_id / string>',
    custom_data: {
      money_spent: 2500,
      subscription: 'gold',
      accepted_agreement: true,
    },
  };
}
HelpCrunch('init', '<your organization domain>', helpCrunchOptions);

Custom data parameters will appear in chat with user at your HelpCrunch admin account just as same as main user attributes (name, email, user id):

Also you will be able to search or filter your users by custom data at the “Contacts” page. There are 5 types of custom data you can search by: integer, float, string, boolean, datetime (example Y-m-d H:i:s)

 

Did this answer your question?