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

OptionTypeRequiredDescription
apiKeystringYesYour Tode API key
debugbooleanNoEnable debug logging (default: false)

Returns

Promise<void>

Notes

  • This method must be called from the plugin controller (where figma global 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

Track your Figma plugin

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

Get your API key