In this guide we’ll show you how to add or remove custom data to Chatway using a JavaScript function.
Using this JavaScript function, you can add or remove any custom data, based on criteria that are specific to your business, such as track customers who placed an order, number of purchased items and so on. You can even use this function to filter and create customer segments.
But first: what’s custom data and what can I do with it?
Custom data tracks data about your customers — like the plan someone is on (free or paid), their purchase status or the number of purchased items.
Here are a few examples:
$chatway.updateChatwayCustomData('purchased_items', '2');
This function can be used to update the customer’s purchased items. By running this in your client’s browser console, you will update their purchase items to the one in the example given above, hence “2”.

$chatway.updateChatwayCustomData('order', 'Completed');
This function can also be used to update your customer’s order status. By running this in your client’s browser console, you will update their order status to the example given above.

$chatway.updateChatwayCustomData('plan', 'Free');
Last but definitely not least, this function can also be used to update your customer’s plan. By running this in your client’s browser console, you will update their plan to the the example given above.

The options are endless and depend entirely on your goals and objectives.
In order to remove any user data using JavaScript, you can use the following JavaScript function:
$chatway.removeChatwayCustomData('Plan');
Click here to learn more about how to update a customer’s email and name, and don’t forget to check our entire Chatway knowledgebase to make the most out of it.