Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.trodo.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Use track to record product-specific behavior: signups, workflow steps, integrations, billing milestones — anything auto-events do not cover.
Backend SDKs are stateless. Node.js and Python require the user’s distinctId / distinct_id as the first argument on every call. The browser SDK is stateful — after identify() the id is remembered in session/localStorage.

Signatures

Trodo.track(eventName, properties?, options?)

Parameters

distinctId / distinct_id
string
required
Backend only. The end-user’s unique id. Required on every call because the server SDKs don’t persist identity.
eventName / event_name
string
required
Name of the event. Prefer snake_case, action-oriented names. Max 255 chars.
properties
object
JSON-serialisable properties for filtering and breakdowns.
options / category
object | string
Node accepts a TrackOptions object ({ category, timestamp }); Python accepts a category string positional. Both default category to "custom".

Basic call

Trodo.track('signup_completed', { plan: 'pro', source: 'pricing_page' });

Bind once, call many (forUser / for_user)

When you’re emitting several events for the same user in a row — a request handler, a background job — bind the distinct id once and call methods on the returned context. The browser SDK doesn’t need this because identity is already bound globally.
// Not needed — identity is bound globally after Trodo.identify()
Trodo.track('checkout_started');
Trodo.track('checkout_completed', { amount_cents: 9999 });

Event category

Override the default custom category when you want to separate a class of events in the dashboard — e.g. security, billing, lifecycle.
Trodo.track('risk_flag_raised', { score: 0.82 }, { category: 'security' });

Batching (server only)

Enable batching at init when your backend emits thousands of events per second. Events are queued in memory and flushed on size/time/explicit flush.
trodo.init({
  siteId: process.env.TRODO_SITE_ID,
  batchEnabled: true,
  batchSize: 50,
  batchFlushIntervalMs: 5000,
});

await trodo.track('user-42', 'job_completed');
// ... many more ...
await trodo.flush();   // before shutdown
Always call shutdown() on process exit to flush the queue.

Naming best practices

Do

signup_completed
agent_run_started
integration_connected
checkout_failed

Avoid

click                # too generic
Event                # no verb
agentRunCompleted    # inconsistent casing (prefer snake_case)

Property best practices

Use typed, bounded values — strings for categoricals, numbers for metrics. Avoid free-form blobs.
// Good
Trodo.track('agent_run_completed', {
  workflow_id: 'weekly_report',
  duration_seconds: 36,
  outcome: 'success',
  surface: 'in_app',
});

// Too vague
Trodo.track('agent_run_completed', { data: 'done', value: 1 });

Reserved names

Don’t send properties that collide with auto-captured fields (page, current_url, referrer, timestamp, user_agent, screen_width, viewport_width, page_title, url, href). They may be stripped.

Error tracking

Wrap fallible code and track both outcomes so you can compute success rates as a ratio.
try {
  await runAgentWorkflow();
  Trodo.track('agent_run_completed', { outcome: 'success' });
} catch (err) {
  Trodo.track('agent_run_failed', {
    outcome: 'error',
    error_type: err.name,
    error_message: err.message,
  });
}
For uncaught backend exceptions, the SDK captures a server_error event automatically when autoEvents is on.

Identify users

Link anonymous sessions to known identities

User properties

Persistent traits that follow the user