πŸ”— Bind Widget to Button

Overview

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

Prerequisites

Before you start, ensure the following:

  • Userback Workspace: A workspace is required to manage feedback.
  • Userback Widget Installed: Follow the Widget Installation Guide to set up the widget.
  • Plan Availability: Available on all plans.

Basic Usage

Binding 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

πŸ›Ÿ Support

Need help? Here’s how to get assistance:

  1. Log in to your Userback workspace.
  2. Click the Help Center icon in the top-right corner.
  3. Select Contact us to start a chat with our support team.