Skip to main content

Overview

Events are the foundation of analytics in Trodo. Every user action you capture—from page views to custom product events—is stored as an event with associated properties.

Event Structure

Every event has this structure:
{
  // Required
  "event_name": "agent_run_completed",
  "distinct_id": "user_12345",
  "timestamp": "2024-01-15T10:30:00.000Z",
  
  // Auto-captured (default properties)
  "session_id": "sess_abc123",
  "current_url": "https://app.example.com/workflows",
  "browser_name": "Chrome",
  "country": "US",
  // ... more default properties
  
  // Custom (your properties)
  "properties": {
    "workflow_id": "weekly_report",
    "duration_seconds": 36,
    "outcome": "success"
  }
}

Event Types

Auto-Events

Captured automatically only when auto-events="true" (or Trodo.enableAutoEvents()). Examples of implemented names:
EventTrigger (summary)
page_viewLoad / route
element_clickAny click
rage_clickRapid repeated clicks on the same element
dead_clickClick with no navigation or DOM change after a short window
page_scrollIncreasing scroll depth
form_submitForm submit
form_validation_errorNative invalid field
form_abandonedStarted a form, left without submit
media_play / media_pauseVideo or audio
text_selectionText highlighted
copy_action / context_menuCopy / right-click
js_error / network_errorErrors (when enabled)
page_performanceCore vitals-style summary after load
exit_intent / page_summaryEngagement / exit aggregates
See Auto-Events for the full catalog, script attributes, and JavaScript API. Custom properties on each event may also include group membership fields merged from set_group / add_group.

Custom Events

Tracked via SDK:
Trodo.track('agent_run_completed', {
  workflow_id: 'weekly_report',
  duration_seconds: 36,
  outcome: 'success'
});

Properties

Properties provide context to events. They come in several categories:

Default Properties

Auto-captured on every event:
PropertyDescription
team_idYour Trodo team
session_idCurrent session
distinct_idUser identifier
website_idSite identifier
event_typeauto or custom
event_nameName of the event
event_categoryCategory grouping
timestampEvent time (ISO 8601)

Custom Properties

Add your own properties to events:
Trodo.track('subscription_upgraded', {
  // Strings
  plan: 'enterprise',
  billing_interval: 'annual',

  // Numbers
  seat_count: 25,
  mrr_delta_usd: 400,

  // Booleans
  is_self_serve: true,

  // Arrays
  enabled_integrations: ['slack', 'salesforce'],

  // Nested objects
  metadata: {
    previous_plan: 'pro',
    sales_assisted: false
  }
});

Event-Specific Properties

Auto event payloads vary by event_name. Examples: element_click (abbreviated):
{
  "click_coordinates": { "x": 120, "y": 340 },
  "page_x": 120,
  "page_y": 540,
  "scroll_x": 0,
  "scroll_y": 200,
  "document_height": 3200,
  "document_width": 1280,
  "double_click": false,
  "element_category": "button",
  "element_tag_name": "button",
  "element_id": "btn-run-workflow",
  "element_text": "Run workflow"
}
page_scroll:
{
  "scroll_depth": 72,
  "max_scroll_reached": 72,
  "scroll_position": 2100,
  "document_height": 3200
}

Property Data Types

TypeExampleNotes
String"enterprise"Max 255 chars for indexed fields
Number1500.50Integer or decimal
Booleantrue / false
Date"2024-01-15"ISO 8601 date
Datetime"2024-01-15T10:30:00Z"ISO 8601 with time
Array["slack", "email"]Homogeneous type recommended
Object{name: "...", value: 100}Nested properties

Best Practices

Event Naming

Use snake_case with clear action verbs:
// ✅ Good
'agent_run_completed'
'integration_connected'
'export_generated'
'onboarding_step_completed'

// ❌ Avoid
'AgentRunCompleted'  // PascalCase
'agent-run-done'     // kebab-case
'run'                // Too vague
'user clicked run'   // Spaces, unclear

Property Naming

// ✅ Good
{
  workflow_id: 'weekly_report',
  surface: 'in_app',
  duration_seconds: 36,
  retry_count: 0
}

// ❌ Avoid
{
  workflowId: 'weekly_report', // camelCase
  'Workflow Id': 'x',          // Spaces
  dur: 36,                     // Abbreviated
  retry: '0'                  // String for number
}

Property Values

// ✅ Good - Consistent, specific
{
  status: 'completed',
  plan_tier: 'enterprise',
  seat_count: 12,
  is_paid: true
}

// ❌ Avoid
{
  status: 'COMPLETED',
  planTier: 'enterprise',
  seat_count: '12',
  is_paid: 'yes'
}

High-Cardinality Properties

Avoid properties with unlimited unique values:
// ❌ High cardinality - avoid when possible
{
  raw_prompt: 'full unstructured text...',
  request_id: 'uuid-per-event'
}

// ✅ Better - categories, lengths, or IDs you control
{
  prompt_length_bucket: 'medium',
  template_id: 'onboarding_v2',
  // Use built-in timestamp instead of a duplicate ms field
}

Limits

LimitValue
Event name length255 characters
Property name length255 characters
String property value8,192 characters
Properties per event255
Array items255
Object nesting depth5 levels

Next Steps

Track Events

Learn the track() method

Auto-Events

Automatic event names and configuration

Groups

Group keys, membership, and enrichment

Default Properties

Full property reference