Skip to main content
All CollectionsUser FeedbackWidget Setup and Customization
How to add custom data to feedback requests?
How to add custom data to feedback requests?
Jon avatar
Written by Jon
Updated over a week ago

Custom data can be added to feedback requests using the Userback JavaScript API. This allows you to include information about the user, such as their account ID or name, along with their feedback.

The JavaScript API is only available on certain plans. If you're unsure if you have access to this feature, check out this article or chat with Userback support team for more information.

To add custom data, you will first need to include the Userback widget code on your website. This code can be found in the Widget Settings section of your Userback account.

Once you have added the widget code, you can use the following method to add custom data:
​

Userback.setData({ key1: value1, key2: value2 });

For example, if you want to include a user's account ID and name with their feedback, you can use the following code:

<script> Userback.setData({ account_id: 7, name: "John Smith" }); </script>

You can also add this data as an option when initializing the widget:

<script> Userback.init('[your widget token]', { custom_data: { account_id: 7, name: "John Smith" } }); </script>

Please note that the custom_data option can also be used instead of setData() method.

You can add as many key-value pairs as you want to the custom_data object, and they will be included with the feedback in your Userback account.

This data can then be used to filter, search and segment feedback to better understand and address customer feedback.

It's important to use appropriate key name to identify the data and keep data privacy compliance in mind when adding custom data to feedback.

Did this answer your question?