TodeTodeDocs
Browse the docs

tode.trackAction()

Track a simple user action in your Figma plugin or widget.

Usage

TypeScript
tode.trackAction('export_clicked');
tode.trackAction('settings_opened');
tode.trackAction('layer_renamed');

Parameters

ParameterTypeRequiredDescription
actionNamestringYesIdentifier for the action. A non-empty string, at most 500 characters
options.eventSource'plugin' | 'ui'NoOverride where the event is reported from. Defaults to where the code runs
options.signalAbortSignalNoCancel the request early. Ignored in code.ts, where Figma has no AbortController

Returns

Promise<void>. It resolves when the request finishes, or right away if the event was held because Tode is not ready yet. It never rejects: failures are logged to the console.

Best Practices

Use descriptive snake_case names:

TypeScript
// Good - clear and descriptive
tode.trackAction('export_to_png');
tode.trackAction('layer_renamed');
tode.trackAction('settings_opened');
 
// Bad - too vague
tode.trackAction('click');
tode.trackAction('action1');

Examples

Track button clicks

TypeScript
const handleExport = () => {
  // Perform export logic...
  tode.trackAction('export_clicked');
};

Track feature usage

TypeScript
const openSettings = () => {
  tode.trackAction('settings_opened');
  // Show settings UI...
};

Track before Tode is ready

TypeScript
// Held and sent once Tode is ready, with the original time
tode.trackAction('plugin_opened');

Up to 50 events tracked before isReady are kept. Later ones are dropped until Tode is ready.

See Also

Track your Figma plugin

Sign up to get your API key and start collecting analytics in minutes.

Get your API key