@userback/widget
TypeScript icon, indicating that this package has built-in type declarations

0.3.9 • Public • Published

@userback/widget

The official NPM module for embedding the Userback.io widget into your Javascript or Typescript application.

Installation

npm i @userback/widget or yarn add @userback/widget

Quickstart

import Userback from '@userback/widget';
Userback('**USERBACK_TOKEN**', options);

Examples

Show the Userback Widget with user data identified.

const options = {
  user_data: {
    id: "123456",
    info: {
      name: "someone",
      email: "someone@example.com"
    }
  }
};

Userback('**USERBACK_TOKEN**', options);

Show the widget on clicking a custom button.

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

After initialisation, you can use the named function getUserback to get a reference to the UserbackWidget.

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

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

For more information about available configuration settings and and functions available, see our Javascript API

Readme

Keywords

Package Sidebar

Install

npm i @userback/widget

Weekly Downloads

15,214

Version

0.3.9

License

MIT

Unpacked Size

27.1 kB

Total Files

7

Last publish

Collaborators

  • lle_userback
  • aliu_userback