You can include custom data with user responses. The custom data may come from URL or it may be generated based on any action on the page and then passed down using JavaScript.
If you are looking to add the URL parameter data inside the conversation, please refer this article.
Add URL parameters in Settings
Let's say your URL is
https://yourwebsite.com/?name=amy&userid=AOJ843Here you have two pieces of information, name and userid that need to be sent along with the form response. Both URL parameters are known to you. In this case, you can pass these URL parameters to the form using custom fields.
Go to Settings of your form, then click on Data Collection. Click on add custom field button and provide the parameters as custom fields. Here you will be adding two keys, name and userid.

Once they are defined in the settings, the form will be able to pick it up and send it along with the rest of the conversation that user had with the form. You will be able to see these data points in the response section as well as in the email notifications.
Note
Passing URL parameters to the form works only when the form is used in Widget mode and when used in Link mode. It will not work in Embed mode. For embed mode we suggest the following method given below.
Adding data using Javascript
You can pass the custom data like the user's email which is available in your web app using our Javascript API's collectchat.set method. Here also, you have to set these keys in Settings > Response of your Bot, like above. An example code:
<script>
var collectchat = window.collectchat || {};
collectchat.ready = function() {
collectchat.set('email', '[email protected]');
collectchat.set('country_code', 'US');
}
</script>
Note
This code will work on both Widget and Embed mode. Please see How to enable developer options when chatbot is in Embed mode? for more information.
Still need help?
Contact us