# Sending Custom Data

You can add custom data on top of the response captured by the chatbot in two
ways.


USING URL PARAMETERS

Our chatbots can automatically capture keys from a URL and send them along with
the rest of the data. To set this up, go to your chatbot's Settings, then click
Data Collection, and use Add custom field to add the keys you want to capture,
as shown below.



Here you can provide the keys present in the URL as custom variables. You can
add multiple keys using the + Add custom field button.

Note: This only works when the chatbot is used in Widget mode or as a Link. If
the chatbot is embedded via iframe, it cannot read URL parameters, so this
method will not work in Embed mode.




COLLECTCHAT.SET(KEY, VALUE)

You can also add custom data using this JavaScript method. Data added this way
can be used in the conversation via @ tags, and is sent along with the rest of
the response. Both key and value are required, and the key must be added as a
custom field under Settings > Data Collection.

Sample code to set the email address of a user, if you already have the data:

var collectchat = window.collectchat || {};
collectchat.ready = function() {
  collectchat.set('email', 'user@email.com');
}