@userback/widget

Quickly integrate Userback via NPM or Yarn with this step-by-step guide and code samples

Overview

The Userback JavaScript package allows you to seamlessly integrate the Userback Widget into your JavaScript or TypeScript application for feedback collection and management.

Installation

To install any of the packages and embed Userback, you'll need a Widget Access Token.

NPM Installation

npm i @userback/widget

Quickstart

To embed the Userback Widget, use the following example code snippets:

JavaScript Example

import Userback from '@userback/widget';

// identify your logged-in users (optional)
const options = {
  user_data: {
    id: "123456",
    info: {
      name: "someone",
      email: "[email protected]"
    }
  }
};

Userback('**Widget Access Token**', options);

Examples

Here are some examples to customize the behavior of the Userback Widget:

Example 1: Delay Showing the Widget

Userback('**Widget Access Token**', { autohide: true }).then(ub => {
    document.querySelector('.my-own-help-button').addEventListener('click', function() {
        ub.show();
    })
})

Example 2: Get a Reference to the Userback Widget

import { getUserback } from '@userback/widget';

document.querySelector('button.screenshot').addEventListener('click', (event) => {
    getUserback().open('bug', 'screenshot');
})

For advanced customization information, refer to our JavaScript SDK documentation.


What’s Next