How to prefill feedback with a name and email?

When you're collecting feedback through the Userback widget, it can be useful to pre-fill the name and email fields for your users. This can be achieved using the Userback JavaScript SDK.


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


To get started, you'll need to include the Userback widget code on your web page, as described in the Userback installation guide. This will ensure that the Userback object is available in the JavaScript scope of your page.


Then, before initializing the widget, set the name and email properties to the desired values

: = "John Smith"; = "";


Finally, initialize the widget using the init method:


Userback.init("[your widget token]");


Now when the Userback feedback button is clicked, the name and email fields will be pre-filled with the values you specified.


It's also possible to pre-fill these fields when initializing the widget by passing options as the second parameter to the init method.


Userback.init("[your widget token]", { name: 'John Smith', email: '' });


You can also attach to on_open event to set the values before the widget is opened.


Userback.on_open = function(){ Userback.setData({ name: "John Smith", email: "" }); }


It's important to note that the user can still change the pre-filled name and email fields before submitting their feedback, but providing them with pre-filled fields can save time and increase the likelihood that they'll submit their feedback.