tode.trackActionWithMetric()
Track an action with an associated numeric value for Figma plugin analytics.
Usage
TypeScript
// Track item count
tode.trackActionWithMetric('items_exported', 42);
// Track processing time
tode.trackActionWithMetric('render_time_ms', 1523);
// Track file size
tode.trackActionWithMetric('file_size_kb', 256);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
actionName | string | Yes | Identifier for the action |
value | number | Yes | Numeric value to track |
Returns
Promise<void>
Use Cases
- Count of items - Number of layers, elements, or items processed
- Processing duration - Time taken for operations in milliseconds
- File sizes - Size of exported files in KB or bytes
- Quantities - Any numeric metric relevant to your plugin
Examples
Track export count
TypeScript
const handleExport = async (items: any[]) => {
// Perform export logic...
tode.trackActionWithMetric('items_exported', items.length);
};Track processing time
TypeScript
const processLayers = async (layers: any[]) => {
const startTime = Date.now();
// Process layers...
const duration = Date.now() - startTime;
tode.trackActionWithMetric('processing_time_ms', duration);
};Track with isReady check
TypeScript
if (tode.isReady) {
tode.trackActionWithMetric('file_size_kb', fileSize);
}See Also
- tode.trackAction() - Track simple actions without values
- tode.isReady - Check if ready to track
- Best Practices - Naming conventions and tips