The official NPM module for embedding the Userback.io widget into your Javascript or Typescript application.
npm i @userback/widget
or yarn add @userback/widget
import Userback from '@userback/widget';
Userback('**USERBACK_TOKEN**', options);
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