tode.init()
Initialize Tode in your Figma plugin's controller code (code.ts). This must be called before any tracking methods.
Usage
code.ts
import { tode } from '@tode-sdk/core';
await tode.init({
apiKey: 'your-api-key',
debug: false
});Parameters
| Option | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your Tode API key |
debug | boolean | No | Enable debug logging (default: false) |
Returns
Promise<void>
Notes
- This method must be called from the plugin controller (where
figmaglobal is available), not from the UI - Must be called before any tracking methods
- Only call once per plugin session
Example
code.ts
import { tode } from '@tode-sdk/core';
// Show your UI
figma.showUI(__html__, { width: 400, height: 600 });
// Initialize Tode
await tode.init({ apiKey: 'your-api-key' });
// Now you can track actions
tode.trackAction('plugin_opened');See Also
- tode.trackAction() - Track simple actions
- tode.isReady - Check initialization status