Skip to content

JavaScript SDK

Once the widget script loads, it attaches a global window.Trackelio object. Use this SDK to control the widget programmatically, identify users, and react to widget events.

Associate the current session with a known user. Identified users skip the guest name/email fields in the Feedback module.

window.Trackelio.identify({
user_id: 'usr_12345',
email: 'jane@example.com',
name: 'Jane Smith',
plan: 'pro', // custom attribute
company: 'Acme Inc.', // custom attribute
});

You can pass any additional key-value pairs as custom attributes. These are stored alongside the submission for filtering in the dashboard.

Open the widget panel. Optionally specify a module to navigate to directly.

window.Trackelio.open();
window.Trackelio.open({ module: 'nps' });

Valid module values: feedback, nps, csat, surveys, messenger, announcements.

Close the widget panel. The trigger button remains visible.

window.Trackelio.close();

Show the trigger button if it was previously hidden.

window.Trackelio.show();

Hide the trigger button and close the panel if it is open.

window.Trackelio.hide();

Pre-fill fields in the Feedback module. Useful for contextual feedback links.

window.Trackelio.prefill({
module: 'feedback',
title: 'Problem with checkout',
description: 'The payment button is unresponsive on mobile.',
});
ParameterTypeDescription
titlestringPre-fill the title field.
descriptionstringPre-fill the description field.
modulestringSwitch to this module when the panel opens.

Override widget configuration at runtime. Changes persist for the current page session.

window.Trackelio.setConfig({
position: 'bottom-left',
panel_width: 480,
branding: {
accent_color: '#10B981',
},
});

See Configuration and Theming for available options.

Subscribe to or unsubscribe from widget events.

function handleSubmit(data) {
console.log('Feedback submitted:', data);
}
window.Trackelio.on('submit', handleSubmit);
window.Trackelio.off('submit', handleSubmit);

See the Events section below for the full list of event names.

Clear all user data (identity and session) and close the panel. The trigger button remains visible.

window.Trackelio.reset();

Remove the widget entirely from the DOM. This detaches the trigger button, panel, and all event listeners. After calling destroy(), window.Trackelio is no longer functional.

window.Trackelio.destroy();

Register event listeners with window.Trackelio.on(event, handler). The handler receives an event-specific data object.

EventFires when
openThe widget panel is opened.
closeThe widget panel is closed.
submitA feedback submission is completed.
screenshotA screenshot is captured.
identifyA user is identified via identify().
resetUser data is cleared via reset().
messenger:startA new Messenger conversation begins.
messenger:messageA message is sent or received in Messenger.
nps:submitAn NPS score is submitted.
csat:submitA CSAT rating is submitted.
module:changeThe user switches to a different module tab.
survey:submitA survey response is submitted.
window.Trackelio.on('nps:submit', (data) => {
console.log('NPS score:', data.score);
console.log('Comment:', data.comment);
});
window.Trackelio.on('module:change', (data) => {
console.log('Switched to module:', data.module);
});