API Methods
All available methods for controlling the FeedbackJar widget.
init
Initialize the widget with your widget ID.
window.fj.init(widgetId, options); Parameters:
widgetId(string, required) - Your widget IDoptions(object, optional) - Configuration options
See Initialization for details.
identify
Personalize the widget. With a server-signed payload, also link feedback to a portal profile — see Auto-login and User Identification.
window.fj.identify({
id: 'user_123',
email: 'user@example.com',
firstName: 'John',
lastName: 'Doe',
avatar: 'https://example.com/avatar.jpg',
// Optional — required to link a portal profile:
organizationId: 'YOUR_ORGANIZATION_ID',
signature: 'GENERATED_ON_SERVER_SIDE',
timestamp: 1234567890123
});
// Clear on logout
window.fj.identify(null); Parameters:
id(string, required when notnull) - Unique user identifier from your systememail(string, optional for display; required when signing) - User emailfirstName(string, optional) - User first namelastName(string, optional) - User last nameavatar(string, optional) - URL to user avatar imageorganizationId(string, optional) - Project ID (required with signature)signature(string, optional) - Server HMAC — see Auto-logintimestamp(number, optional) - Unix ms used when signing
Pass null to clear.
With a signed payload, portal links already on the page (your board, roadmap, changelog URLs) are enriched with auto-login so clicks land signed in. See Auto-login.
setProperties
Attach your own custom key/value context to every submission from now on — merged into the metadata’s app section. Values should be strings, numbers, or booleans; nested objects/arrays aren’t supported.
window.fj.setProperties({
plan: 'pro',
accountId: 'cus_123',
});
// Clear
window.fj.setProperties(null); Parameters:
properties(object ornull) - Custom key/value pairs, ornullto clear
showWidget
Programmatically open the feedback panel.
window.fj.showWidget(); With options:
window.fj.showWidget({
message: 'Tell us what you think!'
}); Parameters:
message(string, optional) - Pre-fill the feedback textarea
hideWidget
Close the feedback panel.
window.fj.hideWidget(); getWidgetState
Get current widget state.
const state = await window.fj.getWidgetState();
console.log(state); Returns:
{
isOpen: boolean,
section: string
} setWidgetPosition
Change widget position.
window.fj.setWidgetPosition('left'); Parameters:
position('left' | 'right') - New position
setTheme
Change widget theme.
window.fj.setTheme('dark'); Parameters:
theme('auto' | 'light' | 'dark') - Theme to apply
setWidgetEnabled
Enable or disable the widget.
// Disable (hides button and panel)
window.fj.setWidgetEnabled(false);
// Enable
window.fj.setWidgetEnabled(true); Parameters:
enabled(boolean) - Whether widget should be enabled
destroy
Remove the widget from the page completely.
window.fj.destroy(); This cleans up all event listeners and removes the widget DOM. Useful for SPA route changes or cleanup.
Method Chaining
Methods are queued if called before the widget loads:
window.fj.init('YOUR_WIDGET_ID');
window.fj.identify({ id: '123', email: 'user@example.com' }); // display-only unless signed
window.fj.setTheme('dark');
window.fj.showWidget(); All methods execute in order once the widget is ready.