Help Center / Widget SDK
Widget SDK API Reference
Complete reference for all UserJot Widget SDK methods.
Core methods
init(projectId, options?)
Initializes the widget with your project configuration.
Parameters:
projectId
(string, required) - Your UserJot project IDoptions
(object, optional) - Configuration options
Example:
window.uj.init('proj_abc123', {
widget: true,
position: 'right',
theme: 'auto',
trigger: 'default'
});
identify(options)
Identifies the current user for personalized experiences.
Parameters:
options
(object | null) - User identification dataid
(string, required) - Unique user identifieremail
(string, optional) - User’s email addressfirstName
(string, optional) - User’s first namelastName
(string, optional) - User’s last nameavatar
(string, optional) - URL to user’s avatar image
Example:
window.uj.identify({
id: 'user_123',
email: 'john@example.com',
firstName: 'John',
lastName: 'Doe',
avatar: 'https://example.com/avatar.jpg'
});
// To logout/clear user
window.uj.identify(null);
Widget control
showWidget(options?)
Opens the widget, optionally to a specific section.
Parameters:
options
(object, optional)section
(string, optional) - Section to open:'feedback'
,'roadmap'
, or'updates'
Example:
// Open to default (feedback) section
window.uj.showWidget();
// Open to specific section
window.uj.showWidget({ section: 'roadmap' });
window.uj.showWidget({ section: 'updates' });
hideWidget()
Closes the widget.
Example:
window.uj.hideWidget();
getWidgetState()
Returns the current state of the widget.
Returns:
object
isOpen
(boolean) - Whether the widget is currently opensection
(string | null) - Current section ('feedback'
,'roadmap'
,'updates'
, ornull
)
Example:
const state = window.uj.getWidgetState();
if (state.isOpen) {
console.log(`Widget is open on ${state.section} section`);
} else {
console.log('Widget is closed');
}
Configuration methods
setWidgetPosition(position)
Changes the widget’s screen position.
Parameters:
position
(string, required) - New position:'left'
or'right'
Example:
window.uj.setWidgetPosition('left');
setTheme(theme)
Changes the widget’s color theme.
Parameters:
theme
(string, required) - Theme mode:'auto'
,'light'
, or'dark'
Example:
window.uj.setTheme('dark');
setWidgetEnabled(enabled)
Enables or disables the widget.
Parameters:
enabled
(boolean, required) - Whether to enable the widget
Example:
// Disable widget
window.uj.setWidgetEnabled(false);
// Re-enable widget
window.uj.setWidgetEnabled(true);
Lifecycle
destroy()
Removes the widget and cleans up all resources.
Example:
window.uj.destroy();
Complete example
// Initialize widget
window.uj.init('proj_abc123', {
widget: true,
position: 'right',
theme: 'auto'
});
// Identify user (e.g., after login)
window.uj.identify({
id: 'user_123',
email: 'john@example.com',
firstName: 'John'
});
// Programmatically open widget
document.getElementById('support-btn').onclick = () => {
window.uj.showWidget({ section: 'feedback' });
};
// Check widget state
const checkState = () => {
const state = window.uj.getWidgetState();
console.log('Widget state:', state);
};
// Clean up (e.g., on logout)
window.uj.identify(null);
window.uj.destroy();
UserJot
Last updated on August 13, 2025.