🔗 Bind Widget to Button

Activate the Widget through Custom UI Elements

Gain control over your Userback widget by linking it directly to a button or other UI elements on your site. This makes it easier for users to provide feedback at the click of a button.

🔐 Company Plan or higher required - Uses JavaScript SDK, more details here.

Prerequisites

  • Userback Widget installed

Basic Usage

open(type: string, destination: string)

To bind the Userback widget to a custom button, use the following code snippet:

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

Note: Values must be strings corresponding to supported Feedback Types and Destinations.


Basic 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 an <a href> 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 also combine multiple buttons and actions. Here's an example:

// 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 Type and Destination

Feedback Types: general, bug, or feature_request

Destinations: screenshot, video, or form


Support & Further Reading

For more information, consult the JavaScript SDK Documentation.

Encounter issues? Please send a message to our support team.