FeedbackJar

API Methods

All available methods for controlling the FeedbackJar widget.

init

Initialize the widget with your widget ID.

javascript
window.fj.init(widgetId, options);

Parameters:

  • widgetId (string, required) - Your widget ID
  • options (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.

javascript
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 not null) - Unique user identifier from your system
  • email (string, optional for display; required when signing) - User email
  • firstName (string, optional) - User first name
  • lastName (string, optional) - User last name
  • avatar (string, optional) - URL to user avatar image
  • organizationId (string, optional) - Project ID (required with signature)
  • signature (string, optional) - Server HMAC — see Auto-login
  • timestamp (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.

javascript
window.fj.setProperties({
  plan: 'pro',
  accountId: 'cus_123',
});

// Clear
window.fj.setProperties(null);

Parameters:

  • properties (object or null) - Custom key/value pairs, or null to clear

showWidget

Programmatically open the feedback panel.

javascript
window.fj.showWidget();

With options:

javascript
window.fj.showWidget({
  message: 'Tell us what you think!'
});

Parameters:

  • message (string, optional) - Pre-fill the feedback textarea

hideWidget

Close the feedback panel.

javascript
window.fj.hideWidget();

getWidgetState

Get current widget state.

javascript
const state = await window.fj.getWidgetState();
console.log(state);

Returns:

javascript
{
  isOpen: boolean,
  section: string
}

setWidgetPosition

Change widget position.

javascript
window.fj.setWidgetPosition('left');

Parameters:

  • position ('left' | 'right') - New position

setTheme

Change widget theme.

javascript
window.fj.setTheme('dark');

Parameters:

  • theme ('auto' | 'light' | 'dark') - Theme to apply

setWidgetEnabled

Enable or disable the widget.

javascript
// 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.

javascript
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:

javascript
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.