Skip to main content

Tracking Events

Events are the foundation of analytics. Each event represents something that happened in your app.

Event Naming

Event names must:

  • Start with a letter (or $ for system events)
  • Contain only alphanumeric characters and underscores
  • Be 255 characters or less
// Valid
track('button_clicked')
track('PurchaseCompleted')
track('step_1_completed')

// Invalid (will be ignored)
track('123_event') // starts with number
track('event-name') // contains hyphen
track('event name') // contains space
Use snake_case

We recommend snake_case for consistency: button_clicked, purchase_completed, user_signed_up.

Event Properties

Properties add context to events:

track('purchase_completed', {
product_id: 'SKU123',
price: 29.99,
currency: 'USD',
items: ['shirt', 'shoes'],
metadata: {
campaign: 'summer_sale'
}
});

Property Types

TypeExample
String"hello"
Number42, 3.14
Booleantrue, false
Nullnull
Array["a", "b", "c"]
Object{ key: "value" }

Limits

  • String values: truncated to 1000 characters
  • Nesting depth: max 3 levels
  • Total properties size: max 10KB

Common Event Patterns

User Actions

track('button_clicked', { button_name: 'submit' });
track('link_clicked', { url: '/pricing' });
track('form_submitted', { form_name: 'signup' });

Feature Usage

track('feature_used', { feature: 'dark_mode' });
track('search_performed', { query: 'shoes', results: 42 });
track('filter_applied', { filter: 'price', value: '0-50' });

Commerce

track('product_viewed', { product_id: 'SKU123', price: 29.99 });
track('added_to_cart', { product_id: 'SKU123', quantity: 1 });
track('checkout_started', { cart_value: 89.99 });
track('purchase_completed', { order_id: 'ORD123', total: 89.99 });

Onboarding

track('onboarding_started');
track('onboarding_step_completed', { step: 1, step_name: 'profile' });
track('onboarding_completed', { duration_seconds: 120 });

Reserved Properties

Properties starting with $ are reserved for system use:

PropertyDescription
$versionApp version
$device_typeDevice type (phone, tablet, desktop)
$device_modelDevice model identifier
$sdkSDK identifier

Avoid using $ prefix for your own properties.

Automatic Properties

Every event automatically includes:

PropertyDescription
platformPlatform (ios, android, web)
os_versionOS version
app_versionApp version
session_idUnique session ID
user_idUser ID (if identified)
timestampEvent timestamp (UTC)