Bind Widget to Button

Easily link the Userback widget to buttons or other UI elements on your site, enabling users to provide feedback with a single click.

📘

Before you start

The Userback widget must be installed on your website. See the Widget Installation Guide if you haven't done this yet.


How to bind the widget to a button

Use the open() method to bind the Userback widget to a custom button.

document.getElementById('myButton').addEventListener('click', function() {
  Userback.open();
});

Note: The open() method accepts strings for Feedback Types and Destinations.


Common use cases

Collect general feedback with a screenshot

document.getElementById('generalFeedbackBtn').addEventListener('click', function() {
  Userback.open('general', 'screenshot');
});

Report a bug with video recording

document.getElementById('reportBugBtn').addEventListener('click', function() {
  Userback.open('bug', 'video');
});

Using a link for general feedback

<a href="javascript:void(0);" id="generalFeedbackLink">General Feedback</a>
document.getElementById('generalFeedbackLink').addEventListener('click', function() {
  Userback.open('general', 'screenshot');
});

Advanced use cases

You can combine multiple buttons and actions for enhanced flexibility.

// Handle general feedback
document.getElementById('generalFeedbackBtn').addEventListener('click', function() {
  Userback.open('general', 'screenshot');
});

// Handle bug reports
document.getElementById('reportBugBtn').addEventListener('click', function() {
  Userback.open('bug', 'video');
});

// Handle feature requests
document.getElementById('featureRequestBtn').addEventListener('click', function() {
  Userback.open('feature_request', 'form');
});

Feedback types and destinations

Feedback types: general, bug, feature_request

Destinations: screenshot, video, form


Need help? Visit the Help Center or use the chat bubble on this page to contact our support team.