@userback/widget
v0.3.7
Published
Userback.io widget for Javascript and Typescript
Downloads
55,525
Readme
@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: "[email protected]"
}
}
};
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