Skip to main content
All CollectionsInstallationAdvanced Installation
Customize the Userback Widget with the JavaScript SDK
Customize the Userback Widget with the JavaScript SDK
Jon avatar
Written by Jon
Updated over a week ago

Are you looking to customize the Userback widget to better suit your website or web application? Userback's JavaScript API provides a powerful tool for developers to tailor the widget's appearance, behavior, and functionality to their specific needs.

In this article, we'll take a closer look at how you can leverage the Userback JavaScript API to enhance the widget's customization, offering practical examples and tips on how you can keep the widget design and customizations consistent across all your projects.

Please note that the Userback JavaScript API is an advanced feature and is only available on certain plans. If you're unsure whether your plan includes the API, check out this helpful article or get in touch with our support team for more information.

Changing the widget color

To change the color of the Userback widget, you can use the setWidgetColor method. This method accepts a hex color code as a parameter and will change the color of the widget to the specified value. Here's an example:

Userback.setWidgetColor('#ff0000');

Changing the widget position

To change the position of the Userback widget, you can use the setWidgetPosition method. This method accepts an object with the x and y coordinates of the widget's position. Here's an example:

javascriptCopy codeUserback.setWidgetPosition({ x: 100, y: 100 });

Capturing additional user information

To capture additional information about the user, you can use the setUser method. This method accepts an object with the user's information, such as their name, email address, and any custom properties that you want to capture. Here's an example:

javascriptCopy codeUserback.setUser({ name: 'John Doe', email: 'john.doe@example.com', company: 'Acme Inc.' });

Keeping the widget design consistent across all projects

One of the biggest advantages of using the Userback JavaScript API is that it allows you to keep the widget design and customizations consistent across all your projects. Instead of manually configuring the widget settings for each project in the Userback UI, you can simply apply the same customizations using the JavaScript API.

For example, if you want to use the same widget color and position on all your projects, you can add the corresponding JavaScript code to your website template or global JavaScript file. This will ensure that the widget looks the same on all your projects, without requiring any additional configuration in the Userback UI.

Did this answer your question?